I'm working on a project which is built on loopback 4, and now the client is asking to have notifications and messaging.
I searched a lot to find the best way to integrate socket.io with loopback 4, no luck, I found nothing
Any ideas?
I'm working on a project which is built on loopback 4, and now the client is asking to have notifications and messaging.
I searched a lot to find the best way to integrate socket.io with loopback 4, no luck, I found nothing
Any ideas?
LoopBack 4 does not have a first-class support for websockets yet. Raymond Feng, LoopBack's architect, created an example project to demonstrate how to route socket.io messages to Controller classes, you can find the project here:
https://github.com/raymondfeng/loopback4-example-websocket/
Quoting from the README:
This example is created to explore how to expose Websocket (socket.io) endpoints in conjunction with LoopBack controllers.
Similarly as @loopback/rest, each websocket server is attached to an http/https server. WebSocket controllers are mapped to different routes (namespaces), for example:
/admins
->AdminController
/chats
->ChatController
When a client connects to the endpoint, a controller is instantiated upon the connection event of the namespace with the socket object. Controller methods can subscribe to one or more message types and send messages to one or more clients.