Here is the compatibility table with the Node.js server:
Swift Client version | Socket.IO server version | ||
---|---|---|---|
2.x | 3.x | 4.x | |
v15.x | YES | YES1 | YES2 |
v16.x | YES3 | YES | YES |
[1] Yes, with allowEIO3: true
(server) and .connectParams(["EIO": "3"])
(client):
Server
const { createServer } = require("http");
const { Server } = require("socket.io");
const httpServer = createServer();
const io = new Server(httpServer, {
allowEIO3: true
});
httpServer.listen(8080);
Client
SocketManager(socketURL: URL(string:"http://localhost:8080/")!, config: [.connectParams(["EIO": "3"])])
[2] Yes, allowEIO3: true
(server)
[3] Yes, with .version(.two)
(client):
SocketManager(socketURL: URL(string:"http://localhost:8080/")!, config: [.version(.two)])
See also:
- Migrating from 2.x to 3.0: https://socket.io/docs/v4/migrating-from-2-x-to-3-0/
- Migrating from 3.x to 4.0: https://socket.io/docs/v4/migrating-from-3-x-to-4-0/
- Socket.IO protocol: https://github.com/socketio/socket.io-protocol