Closed abh closed 4 years ago
I use something like fanout. "It's super effective". Just one, custom server written in Go, which publishes to push-stream servers. I added fancy feature like adding and disabling servers live, so I can take anything to maintenance.
I'll try to write it in some better-looking way, because now it's trash and share if someone will contact me :)
@misiek08 I'd be interested in details. Could you send an email to msurguy @ gmail ?
I suspended Go version for now. Is great, but my solution is used by 2 companies and noone there knows Go, so they required node.js version.
I set up 2 routes /add and /del/:id and I add server to array or remove it. I connect to master server, where sources are publishing, connect to all servers from array and on every message I'm sending that message async to each server from array. No logging, no error handling (only retry few times) and no tests.
Ah, simple enough then! How does the client know which server to connect to?
My case have separate producers and subscribers. More like announcement not chat. Client need some way to filter chats and generate some events so user posts by ajax call and get messages by sockets, so I don't need to know which server can I send to, just connect to any slave and listen for messages.
This is a variation of #42.
For some use cases (lots of subscribers to the same channels) it'd be useful to have an "upstream server" so when a subscriber connects, the module will connect to the upstream and subscribe there. If thousands of users are subscribing to the same channel only one connection will be active to the upstream.