clients should really avoid using more than one socket anyway. closing the socket needlessly or opening a dozen of them, the real spam going on here is websocket handshakes.

idk exactly what the best way to do this is because if it was Go, i would have a client connection goroutine with a channel that other parts of the app send requests to, and this would isolate the management of the client connection from the app. my guess is that the right way to do it is put the client connection management into a service worker and use its IPC as a channel in the same way as i would do it if it was using go, which i think anyway is going to be a serial queue, thus processing requests as they arrive as the socket becomes available after the previous message is dispatched.

Reply to this note

Please Login to reply.

Discussion

No replies yet.