Closed lantica closed 1 year ago
Sorry no plans at the moment for that, do versions 3.x and 4.x totally break backwards compatibility?
Edit: it seems that we can upgrade at least safely to 3.x on the server side:
Update: As of Socket.IO 3.1.0, the v3 server is now able to communicate with v2 clients. More information below. A v3 client is still not be able to connect to a v2 server though.
Yes, there is backward compatibility for both v3.x and v4.x server to v2.x client.
However, an option (allowEIO3: true
) will be required in order for the backward compatibility.
I have tried just updating the socket-io to v4.1.3 with that option, it seems to be work fine with v2.x client.
The sockets is the main part of the codebase without tests (I'm not even sure how to approach testing here) so migration is not going to be easy at all to ensure compatibility, specially with how large socket.io API is.
I created a small example for socket.io, and I'll be adding more and more bits (or maybe other examples) to check whether it works as intended both with 2.x
and 4.x
. Unfortunately I'm limited on time, so the earliest I feel comfortable shipping this is September
If you need it right now, you could do it in a not-too-difficult way:
{ socket: false }
plugins/socket/index.js
into your codebase e.g. into ./mycodebase/socket.js
newsocket
or something different, and update accordinglynpm i socket.io@4
const server = require('server');
const newsocket = require('./mycodebase/socket');
server.plugins.push(newsocket);
server.router.socket = newsocket.router;
server({ router: false }, ...);
I haven't tried this, but AFAIK this should be it so please feel free to report any issue trying to follow these steps.
Thanks! I guess we can close this now :)
Note: not released yet, will be released within a couple of days
The socket.io using now is v 2.x, which means client using v3.x / 4.x will not be able to connect. I would like to know is there any plan for updating it?