fedesilva / monix-sample

A project exemplifying client / server communications with Monifu

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Monifu Client/Server Sample

Sample of a mixed client/server application demonstrating the streaming of values over web-socket, both simple and with back-pressure applied (by means of the Reactive Streams protocol), using Monifu for both the server and the client ;-)

See: monifu-sample.herokuapp.com

Gitter

Overview of the code:

NOTES:

  • we are exposing 2 versions of webSocket connections, one that is back-pressured as a matter of the server-side protocol and one that is not
  • both versions are protected by buffers that start dropping events in case the client is too slow, but the difference is that for the back-pressured version the buffer is being maintained server-side
  • by applying back-pressure in the protocol, the server is informed of the rate at which the client can consume and thus there is no risk for the server in case we've got clients that are too slow; on the other hand for the simple version the server can be crashed on clients that are too slow in receiving their events, as that actor's mailbox is unbounded
  • the back-pressured version needs server-side cooperation / implementation and is thus more difficult to develop

In order to develop and execute the project locally:

sbt run

The project is based on the cool play-with-scalajs-example template by @vmunier, so you get the auto-reload coolness of Play in combination with Scala.js.

~;Enjoy

About

A project exemplifying client / server communications with Monifu

License:Apache License 2.0


Languages

Language:Scala 93.0%Language:HTML 5.0%Language:CSS 2.0%