Skip to main content
nestrs-ws speaks RFC 6455 JSON events ({ "event", "data" }). For the Socket.IO protocol that NestJS apps use via @nestjs/platform-socket.io, add nestrs-socketio. It builds a socketioxide Tower layer and merges it onto the router from NestApplication::into_router.

Install

You do not need the ws feature to compile this crate. Enable it only if the same process also serves nestrs-ws gateways.

Mount Socket.IO

socketio_layer returns (SocketIoLayer, SocketIo). Register namespaces on io before merge_socketio. merge_socketio is router.layer(layer).

Compared with nestrs-ws

Keep nestrs-ws for first-party JSON gateways. Use this crate when browsers or Nest clients speak Socket.IO.

API

See the socketioxide handbook for rooms, acknowledgements, and binary events.