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 Mi Piace

@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 Mi Piace

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 Mi Piace

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

1 Mi Piace

@sam Da quello che ho capito leggendo il README e questa discussione, message_bus sembra essere un sistema di notifica puro (qualcosa come un’alternativa a Pusher)

Ho ragione nel dire che non è progettato per implementare l’event sourcing nei sistemi distribuiti?

Tutti gli esempi qui sono piuttosto correlati al recupero di messaggi a breve termine, ma non è possibile ripristinare lo stato precedente dell’app dal flusso di eventi, a causa del meccanismo di troncamento. C’è qualcosa che mi sono perso?

2 Mi Piace

Tecnicamente potresti aumentare la retention e usare PG come backend. Detto questo, mantenere un transaction log per sempre ha sicuramente dei costi. Ricostruire un database da 10 anni di transazioni, sebbene fattibile, probabilmente non è qualcosa che faresti.

4 Mi Piace