-
-
Notifications
You must be signed in to change notification settings - Fork 121
Description
First of all, thanks a lot for this awesome library!
I’m trying to create a very basic WebSocketRoute that simply broadcasts events from the server to all connected clients. In this case, I don’t need to call anything on that endpoint — only have listeners (for example, listening for new chat messages in a read-only mode).
I was wondering if this is possible with Nestia? Ideally, I’d like to access that endpoint through the generated SDK instead of writing my own implementation.
I checked out the chat example, but honestly I don’t really understand how to emit events from the server without first waiting for a client function call.
Also, is there any way to access the underlying WebSocket within the method? My use case is that I’m consuming events from another WebSocket, and I’d like to pipe those events directly to the client. (Though I assume this might cause type issues — just asking to be sure.)
And finally, is there a way to detect when a connection is closed? I need to run some cleanup whenever a user disconnects, regardless of the reason.
Any tips or guidance on these points would be greatly appreciated!