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

@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?

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.

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

@sam READMEとこのスレッドを読んだ限りでは、message_busは純粋な通知システム(Pusherのようなもの)のようです。

分散システムでイベントソーシングを実装するために設計されたものではない、と言っても正しいでしょうか?

ここでのすべての例は、短期的なメッセージのキャッチアップに関連していますが、トランケーションメカニズムのため、イベントストリームから古いアプリの状態を復元することはできません。何か見落としたことはありますか?

技術的には、保持期間を増やしてPGをバックエンドとして使用できます。とはいえ、トランザクションログを永遠に保持することには確かにコストがかかります。10年間のトランザクションからデータベースを再構築することは、可能ではありますが、おそらくあなたがやろうとしていることではないでしょう。