I'm using Lucee - for sending real-time (simple JS...
# lucee
m
I'm using Lucee - for sending real-time (simple JSON) notifications to the browser, is the websocket extension the best way, or something better/more current? I'm having issues getting it to work, but before I spent too much more time, I want to make sure I'm going the right direction. maybe browser notifications are better?
b
I recommend using websockets but the websocket extension is basically unsupported and I dont' recommend it
I use RabbitMQ with the STOMP websocket plugin and it works very well
I really love the queue/message semantics for websockets and I can send broadcast messages to topics with any number of listening clients as well as send messages back from the browser to the server
And Rabbit allows me to enforce authentication to control what topics a given user can subscribe to
And since RabbitMQ is a single service (I run it on Docker), I can scale out as many Lucee servers as I like and they all "know" about all the subscribers, no matter what CF server you're hitting
All of the built-in CF websocket solutions suffer from the same issue of not clustering well
For example, if you have 5 clustered CF servers and 500 users, with roughly 100 users connected to the websocket listener on each of your 5 servers. If you try to broadcast a message from server 3, only 20% of your users will receive it-- the 100 users that happen to be connected to that server.
RabbitMQ becomes the single point of all web socket connections. Now Server number 2 sends a message to a topic in rabbit that, in turn, is broadcast to ALL connections.
If you need to scale to more than several thousand connections (browser), I'd look at a hosted service like socket.io, which operates on a similar idea, but now you pay for a hosted cloud SASS that is fielding all the incoming websocket connections and you use an API to ask it to send stuff out
m
thanks for all the info! I will do some research and learning
m
You can use firebase for that