-
Notifications
You must be signed in to change notification settings - Fork 22
Run websocket only mode for Socket.IO #16
Comments
I'm sorry I don't understand the reason and won't spend time to deal with your unusual use-case, even if this is technically feasible. Please read Socket.io room-support
Good Luck, |
I completely understand that Socket.IO is not a Websocket implementation. However, your library supports Socket.IO (at least with one concrete example in your library) - therefore I was hoping that you support entire Socket.IO capability (including "websocket only" mode). If you look closer to the Socket.IO documentation, Socket.IO is capable to connect in a mode called "websocket only" (as opposed to "polling"). And this "websocket only" mode of Socket.IO is obviously badly supported/documented with your Arduino library. The reasons we want the "websocket only" mode are: Due to scallablility and the limited number of clients of one Socket.IO node, the Cloud Run Server creates new nodes whenever needed. And those nodes are slow if used with "polling". Therefore the need of a "websocket only" mode. |
I'll create a new version for you to test, using Will let you know when it's ready by tomorrow |
Hi @iKK001 The WebSockets_Generic Releases v2.11.1 has just been published to to add support to websocket only mode for Socket.IO ( Your enhancement request, leading to new v2.11.1, has also been noted in Contributions and Thanks. You have to use WebSocketClient_Sticky_SocketIO_NINA instead of WebSocketClientSocketIO_NINA, with the new selection
See the new handshake now is
Please test and post any new issue of this new release. Thanks. Best Regards, Release v2.11.1
|
Thank you very much for this kind extension of the library. I appreciate it. Using your new "sticky-session mode" library update, I observed that the initial connection starts with a "https" connection. However, Socket.IO in a "sticky-session only mode" must work with "wss" protocol.
I suscpect that you tested the Arduino library change on a http-server instead of a socket.io-server. Below a working example established on a Web-client (not Arduino) with just "websocket only transport". |
Because you didn't specify how your server is using, the code WebSocketClient_Sticky_SocketIO_NINA example was tested with this Multi_Sticky_SIO server as follows:
If you're using different server mode, such as specified in Using multiple nodes with nodejs-cluster, you can just use the normal WebSocketClientSocketIO_NINA example socket.io sticky-session Server
I think the transport mode will be automatically changed to during the negotiation from
to
Debug Terminal
I'm sorry I don't have more time to help here. I suggest if you have more issues, test on ESP32/ESP8266, then post the issue in arduinoWebSockets library issues for help. Good Luck, |
I understand that it was not clear how I set up the server. I also understand that it takes a bit of a moment to understand the two major ways you can run a multi-node Socket.IO configuration. In my case, there are several server nodes running but without "sticky-session" and without http-protocol. The way I run the multiple Server-nodes is without the need of an expensive load-balancer. (i.e. only with "websocket" and NO long-polling http). (as described here under Remarks point 2) - it says:
Therefore I am not running the server-nodes with "sticky sessions" but instead with "websocket only". You can achieve that by instantiating one server-node with the necessary Server-Option as follows:
(Instead of what you did: The corresponding Web-Client option is described here. So it is very simple for you to test: Simply add the Server-Option All we need is a server that only relies on "websocket" (and no longer uses any kind of http). With such a "websocket-only"-Server, you can then hopefully see what to improve in your client-library. The important thing is that your library only uses "wss://" protocol (or "ws://" for local server) at any time (i.e. no longer "http" and upgrade to "ws" as in default mode). Please give it a chance. Thank you very much. |
That
|
Is there a way to run "websocket" only mode with Socket.IO on this Arduino library ?
I made a local Socket.IO client that works well with the WebSockets_Generic Example "WiFiNINA-->WebSocketClientSocketIO_NINA" - but only if the server has "transport=["polling", "websocket"]," defined.
If I change the server to "transport=["websocket"]," then it does not work anymore.
However, our application absolutely requires "websocket only" configuration !
On other Socket.IO clients there is a possibility to force to "websocket only".
For example in the iOS-client there is a config setting called ".forceWebsockets(true)," that makes exactly that.
The keyword, I think, is called "websocket only". Please refer to the Socket.IO documentation here and the error you get if websocket only is missing is explained here
Is there a "websocket only" mode for the WebSockets_Generic library ?
If yes, how would I configure it ?
The text was updated successfully, but these errors were encountered: