I am in the process of developing a JavaScript event subscriber for NServicebus, and I am seeking feedback on my approach as well as any potential pitfalls to watch out for in this design.
My proposed components are as follows:
ASP.NET MVC BusController (ASyncController)
- Receives subscriptions from JavaScript clients and provides a sessionId for further communication.
- Async ActionMethod Receive returns a JSON serialized EventMessage.
- Utilizes a generic message handler to filter and queue events for subscribed clients.
JavaScript client
- Can subscribe to one or multiple events using the subscribe method on the BusController.
- Receive events through long-polling of the Receive method on the BusController with the assigned sessionId.
However, there are a couple of concerns:
- How to detect when a client disconnects?
- Considering implementing a timeout system that prompts the client to reconnect with the Receive ActionMethod.
- Concerns about the performance of a generic message handler in the buscontroller handling all messages in the system. Has anyone encountered this issue before?