2021-07-10 11:32:24 +02:00

1.2 KiB

Upgrading from v15 to v16

This guide will help you navigate the changes that were introduced in v16.

Objective-c is no longer supported. You must now use Swift.

Client supports multiple socket.io versions

The client now supports socket.io 3 servers. This is mostly a transparent change, however if your server is socket.io 2, you must send .version(.two) as an option to the manager.

SocketManager(socketURL: URL(string:"http://localhost:8087/")!, config: [.version(.two)])

How to upgrade

  • first, upgrade the Socket.IO server to v4 with the compatibility mode enabled (allowEIO3: true)
  • then, upgrade the clients to v16
  • finally, once all clients have upgraded, disable the compatibility mode

You can check the version of the connection on the server side with:

io.on("connection", (socket) => {
  // either 3 for the 3rd revision of the protocol (Socket.IO v2) or 4 for the 4th revision (Socket.IO v3/v4)
  const version = socket.conn.protocol;
});

See also: