Overview of @loopback/socketio
masterThe @loopback/socketio module uses socket.io to expose LoopBack controllers as WebSocket-friendly endpoints. It is currently marked as Experimental.
Key Constructs
- SocketIoServer: A server type that listens for incoming WebSocket connections and dispatches messages to controllers subscribed to specific namespaces. Each server is attached to an http/https endpoint.
- SocketIo controller: A controller class decorated with metadata to handle:
- Namespace mapping
- Connect/disconnect events
- Subscribing to/consuming messages
- Publishing/producing messages
- SocketIo middleware or sequence: Allows intercepting and processing WebSocket messages with common logic.