Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Using slanger and websockets to power a warehouse backend

Using slanger and websockets to power a warehouse backend

Websockets are fun for chats and online games. But are there serious uses? ...

04cf030f16631ae24b82f58ffd3917a1?s=128

schokomarie

August 18, 2012
Tweet

Transcript

  1. $whoami Samstag, 18. August 2012

  2. Using slanger and websockets to power a warehouse backend Samstag,

    18. August 2012
  3. © NBC Samstag, 18. August 2012

  4. What? •a web application for a printing company to simplify

    the packing process Samstag, 18. August 2012
  5. What? •the system runs on a touchscreen desktop in kiosk

    mode and needs to be synchronized in realtime Samstag, 18. August 2012
  6. © NBC Samstag, 18. August 2012

  7. websockets •native browser support •real bi-directional connection •less overhead than

    ajax-requests •easier to handle than long-polling Samstag, 18. August 2012
  8. © NBC Samstag, 18. August 2012

  9. protocol •roll your own •pre-made Samstag, 18. August 2012

  10. pusher •a webservice sending realtime messages between clients •german Datenschutz:

    can not send german client data to an us-based service Samstag, 18. August 2012
  11. © NBC Samstag, 18. August 2012

  12. slanger •open source websocket server •runs on a local machine

    •compatible with pusher‘s API •thus compatible with pusher. js Samstag, 18. August 2012
  13. architecture •Padrino backend •slanger •html-5 client Samstag, 18. August 2012

  14. architecture •application handles entity changes and sends events to slanger

    •client subscribes to slanger events •slanger dispatches events to the client •client uses event data to render mustache templates Samstag, 18. August 2012
  15. Samstag, 18. August 2012

  16. Samstag, 18. August 2012

  17. advantages •very simple client side js code •almost no logic

    in the client •server side business logic Samstag, 18. August 2012
  18. © NBC Samstag, 18. August 2012

  19. handle with care •Never mix client-side events with server-side events

    •keep all business logic on the server •Minimize assumptions about event behaviour in the client Samstag, 18. August 2012
  20. © NBC Samstag, 18. August 2012

  21. © NBC Samstag, 18. August 2012

  22. pitfalls •correct redis version (≥2.4.14) •slanger is an app, not

    a lib Samstag, 18. August 2012
  23. stuff • https://github.com/stevegraham/slanger • https://github.com/defunkt/resque • http://redis.io/ • https://github.com/padrino/padrino-framework •

    http://handlebarsjs.com/ • http://twitter.github.com/bootstrap/ • http://www.websocket.org/quantum.html Samstag, 18. August 2012
  24. © NBC Samstag, 18. August 2012