How discourse stays online (Message Bus, Faye, Long Polling)

Yeah, the whole backend is powered by message_bus. The android/ios client long-polls. Not sure if this is the best use of message_bus, but It works w/o the added complexity of web sockets. The major win is that it fits in our existing rails stack. The only disadvantage i’ve come across so far is that I can’t find an elegant way to support the typing indicator.

http://www.eggie5.com/58-real-time-messenging-w-ruby-ios-android

6 „Gefällt mir“

@sam I see this works with Thin. What about Unicorn, I’ve read that Thin is excellent (best supported) with Long-Polling, is this why you only support Thin when using Long-Polling with your message_bus gem?

Please correct me if I’m wrong but looking at the code Long-Polling seems to be enabled if Thin is running?

1 „Gefällt mir“

It works fine with unicorn, in fact we host all our sites on unicorn.

unicorn, passenger and puma all support rack hijack. This means message_bus can pull sockets out of the normal lifecycle and release the connections back to unicorn while keeping the socket open.

1 „Gefällt mir“

That’s great to know. Thank you. Will read up on rack hijack.

1 „Gefällt mir“

@sam Soweit ich das aus der README und diesem Thread entnehmen konnte, scheint message_bus ein reines Benachrichtigungssystem zu sein (so etwas wie eine Pusher-Alternative).

Liege ich richtig in der Annahme, dass es nicht für die Implementierung von Event Sourcing in verteilten Systemen konzipiert ist?

Alle Beispiele hier beziehen sich eher auf kurzfristige Nachrichtenabgleiche, aber es ist nicht möglich, alte Anwendungszustände aus dem Ereignisstrom wiederherzustellen, da der Mechanismus gekürzt wird. Habe ich etwas übersehen?

2 „Gefällt mir“

Technisch gesehen könnten Sie die Aufbewahrung erhöhen und PG als Backend verwenden. Dennoch hat die Aufbewahrung eines Transaktionsprotokolls für immer sicherlich Kosten. Das Wiederaufbauen einer Datenbank aus 10 Jahren Transaktionen ist zwar machbar, aber wahrscheinlich nichts, was Sie tun würden.

4 „Gefällt mir“