Hi all,
I’m currently building a React frontend to a headless Discourse server.
I am in the process of implementing the notifications count, similar to the one over the users avatar on here. I’d like this to be updated in near real-time using long polling over Discourse’s message_bus.
I have seen the message-bus.js file but it is very verbose and out of date for a modern application. I don’t really want to be bringing in jQuery and a global object when we should be doing it as part of the react application.
I have also seen in /initializers/subscribe-user-notifications.js.es6 that we subscribe to /notification/userid
but I cannot find documentation for the channels available to subscribe to or what the responses are.
I’m looking for help as to the best-practice way to implement subscribing to message bus in a modern javascript application.
Thanks!