Configure Socket.io

Hello everyone,

I would like to have Socket.io use the “WebSocket” transport only (no HTTP long-polling), as described in the docs: How it works | Socket.IO

I’m not sure where to even start looking to achieve this. Any help or pointers would be greatly appreciated.

Thank you.

Hi @bgmike,

I’m not too sure whether the socket.io-protocol actually allows this. It seems that http long-polling is the “default” mode and changing to websocket only happens once the http connection has been established. Anyway, you might be better off asking them directly.

I have to ask, since I’m a bit confused; is there a special why you don’t want to use the long-polling mechanism?

On another note: We’re currently in the process of refactoring our messaging system, so it might be easily possible to exchange the socket.io implementation with a normal websocket once that’s completed.

Hello @msujew

My apologies for the delayed response.

The socket.io transport configuration is not on socket.io-protocol. It’s actually on the client and server instances. In @theia/core those are here (server) and here (client), and unfortunately it looks like that config is not exposed via a contribution or something similar.

The reason I don’t want the long-polling enabled is because the environment I am deploying to does not support sticky-sessions on the ingress currently. So I either have to run only 1 instance of the application or come up with a way to make that configuration change. I’m going to run a single instance for now, and come back to this issue later.

I’ll keep an eye on the message system refactor. Thank you for pointing it out :slight_smile: