Aller au contenu principal

Monthly update #5

· 2 minutes de lecture
Damien Arrachequesne

Hi everyone!

Here's the #5 edition of our Monthly update.

So, what's new in the Socket.IO ecosystem?

A new API for inter-server communication​

This feature had been requested for quite some time, it is now implemented in release 4.1.0. It allows to broadcast events between your Socket.IO servers.

The syntax is very similar to the existing one, except it's for server-to-server communication:

io.serverSideEmit("hello", "world");

And on the receiving side:

io.on("hello", (arg1) => {
console.log(arg1); // prints "world"
});

Acknowledgements are supported too:

// server A
io.serverSideEmit("ping", (err, responses) => {
console.log(responses[0]); // prints "pong"
});

// server B
io.on("ping", (cb) => {
cb("pong");
});

You can find the complete release notes here.

New official adapters​

Historically, the Redis adapter was the only official adapter when scaling to multiple nodes.

There are now three additional official adapters:

Note: the first two were inspired from existing adapters maintained by the community and were updated to support Socket.IO v3.

All of them supports the utility methods that were added in v4, including the serverSideEmit() method described above.

Additional documentation​

Version updates​

What's next​

  • a continuous focus on the documentation (additional code examples, extended guide, ...)
  • additional tooling around Socket.IO

Happy coding!