|
| 1 | +Here is the compatibility table with the Node.js server: |
| 2 | + |
| 3 | +<table> |
| 4 | + <tr> |
| 5 | + <th rowspan="2">Swift Client version</th> |
| 6 | + <th colspan="3">Socket.IO server version</th> |
| 7 | + </tr> |
| 8 | + <tr> |
| 9 | + <td align="center">2.x</td> |
| 10 | + <td align="center">3.x</td> |
| 11 | + <td align="center">4.x</td> |
| 12 | + </tr> |
| 13 | + <tr> |
| 14 | + <td align="center">v15.x</td> |
| 15 | + <td align="center"><b>YES</b></td> |
| 16 | + <td align="center"><b>YES</b><sup>1</sup></td> |
| 17 | + <td align="center"><b>YES</b><sup>2</sup></td> |
| 18 | + </tr> |
| 19 | + <tr> |
| 20 | + <td align="center">v16.x</td> |
| 21 | + <td align="center"><b>YES</b><sup>3</sup></td> |
| 22 | + <td align="center"><b>YES</b></td> |
| 23 | + <td align="center"><b>YES</b></td> |
| 24 | + </tr> |
| 25 | +</table> |
| 26 | + |
| 27 | +[1] Yes, with <code><a href="https://socket.io/docs/v4/server-initialization/#allowEIO3">allowEIO3: true</a></code> (server) and `.connectParams(["EIO": "3"])` (client): |
| 28 | + |
| 29 | +*Server* |
| 30 | + |
| 31 | +```js |
| 32 | +const { createServer } = require("http"); |
| 33 | +const { Server } = require("socket.io"); |
| 34 | + |
| 35 | +const httpServer = createServer(); |
| 36 | +const io = new Server(httpServer, { |
| 37 | + allowEIO3: true |
| 38 | +}); |
| 39 | + |
| 40 | +httpServer.listen(8080); |
| 41 | +``` |
| 42 | + |
| 43 | +*Client* |
| 44 | + |
| 45 | +```swift |
| 46 | +SocketManager(socketURL: URL(string:"http://localhost:8080/")!, config: [.connectParams(["EIO": "3"])]) |
| 47 | +``` |
| 48 | + |
| 49 | +[2] Yes, <code><a href="https://socket.io/docs/v4/server-initialization/#allowEIO3">allowEIO3: true</a></code> (server) |
| 50 | + |
| 51 | +[3] Yes, with `.version(.two)` (client): |
| 52 | + |
| 53 | +```swift |
| 54 | +SocketManager(socketURL: URL(string:"http://localhost:8080/")!, config: [.version(.two)]) |
| 55 | +``` |
| 56 | + |
| 57 | +See also: |
| 58 | + |
| 59 | +- Migrating from 2.x to 3.0: https://socket.io/docs/v4/migrating-from-2-x-to-3-0/ |
| 60 | +- Migrating from 3.x to 4.0: https://socket.io/docs/v4/migrating-from-3-x-to-4-0/ |
| 61 | +- Socket.IO protocol: https://github.com/socketio/socket.io-protocol |
0 commit comments