Replies: 1 comment 2 replies
-
Hello, |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Socket.io is a great tool for push notifications. However, the current implementation of @loopback/socketio assumes it will be responsible for creating the http server itself.
Socket.io supports attaching to an existing http server, including the one created by RestApplication. These two features should be allowed to work together, to deliver both a restful api, and socket-based event subscriptions, from the same ip and port.
@loopback/socketio needs to be refactored to allow an external server class to be configured, such as "RestServer". The idea is that the server instance is retrieved from the current context, when the start observer is fired, which socket.io is then attached to. If this configuration is not provided, then falling back to creating its own http server is fine.
Example implementation of the observer (simplified and incomplete):
Also: SocketIoComponent will have to register SocketIoServer as a life cycle observer, instead of as a server, to prevent RestApplication from throwing an exception, when using attach mode.
Beta Was this translation helpful? Give feedback.
All reactions