vbmithr / ocaml-websocket

Websocket library for OCaml
ISC License
161 stars 44 forks source link

websockets + react hangs on frequent messages #95

Closed meadofpoetry closed 6 years ago

meadofpoetry commented 6 years ago

I'm not sure whether I should post this here or in react's issue tracker, but I have an issue with using websockets with react and cohttp. I have an application, which listens to zmq socket for a json message, stores it in the database and notifies client about received message through websocket. I use react event stream to represent my stream of messages and map it on notification event stream with E.map. It works fine when messages are either appearing relatively rarely or messages are short and simple. When the messages are big (and require a long deserialization) and appear quite often (say 5 times a second) the whole event stream hangs.

I'm not sure but I suspect that due to performance issue some react invariant becomes broken which leads to such behaviour. I'm posting it here since the problem occurs only when I use websockets, in other cases even relatively heavy computations does not have such effect.

I've made a trivial example to depict the issue.

https://github.com/Freyr666/socktest

Thanks ahead.

meadofpoetry commented 6 years ago

closed, thanks to

https://github.com/dbuenzli/react/issues/27