I use both in my web client. https has a lot of overhead for each request. Perfectly fine for responding to user requests but not great for real-time event-driven behaviour. Sockets is better.

Reply to this note

Please Login to reply.

Discussion

my understanding is that if the requests are less than 3, or are distributed over minutes, than http.

Else websocket.

wdyt?

Yep. Good old https rest api does the job for 95% of the functionality. However, when you need async event driven stuff, websockets is the way to go. For example, when I am waiting for a Lightning payment, I prefer to use a websockets to push the event through when it comes rather than poll for it. A lot less stress on the server.

If you're going for raw performance and you don't care about backwards-compatibility or about breaking the openness and simplicity of the protocol there are ways to do things that are much better than JSON over WebSockets or HTTP.

gr8"ways" t y/