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 Me gusta

@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 me gusta

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 me gusta

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

1 me gusta

@sam Por lo que entendí al leer el README y este hilo, message_bus parece ser un sistema de notificación puro (algo así como una alternativa a Pusher).

¿Estoy en lo correcto al decir que no está diseñado para implementar event sourcing en sistemas distribuidos?

Todos los ejemplos aquí están más relacionados con la recuperación de mensajes a corto plazo, pero no es posible restaurar el estado antiguo de la aplicación a partir del flujo de eventos, debido al mecanismo de truncamiento. ¿Hay algo que me haya perdido?

2 Me gusta

Técnicamente, podrías aumentar la retención y usar PG como backend. Dicho esto, mantener un registro de transacciones para siempre tiene costos. Reconstruir una base de datos a partir de 10 años de transacciones, aunque factible, probablemente no sea algo que harías.

4 Me gusta