Advertisement

NullMQ @ PDX

Hacker-philosopher at Twilio
Feb. 23, 2012
Advertisement

More Related Content

Advertisement
Advertisement

NullMQ @ PDX

  1. NullMQ ZEROMQ SEMANTICS IN THE BROWSER Jeff Lindsay Bulat Shakirzyanov @progrium @avalanche123
  2. libzmq
  3. High-level patterns libzmq
  4. Philosophy High-level patterns libzmq
  5. Philosophy High-level patterns libzmq
  6. Philosophy High-level patterns API / Semantics libzmq
  7. Toolkit for building messaging systems...
  8. Toolkit for building messaging systems... ...behind your firewall
  9. Toolkit for building messaging systems... ...behind your firewall ...not for customers
  10. Toolkit for building messaging systems... ...behind your firewall ...not for customers ...certainly not with the browser
  11. WITH VOICE MAKE & RECEIVE PHONE CALLS SEND & RECEIVE TEXT MESSAGES INSTANTLY BUY PHONE NUMBERS ADD VOICE TO WEB & MOBILE APPS
  12. Browser Browser
  13. ZeroMQ in the browser?
  14. ZeroMQ in the browser? • libzmq is a C++ library
  15. ZeroMQ in the browser? • libzmq is a C++ library • Browser extension not viable
  16. ZeroMQ in the browser? • libzmq is a C++ library • Browser extension not viable • ZMTP is not valuable by itself
  17. Let’s say we did...
  18. Let’s say we did... • Security?
  19. Let’s say we did... • Security? • Skip existing auth infrastructure
  20. Let’s say we did... • Security? • Skip existing auth infrastructure • Need to make something up
  21. Let’s say we did... • Security? • Skip existing auth infrastructure • Need to make something up • Direct connections?
  22. Let’s say we did... • Security? • Skip existing auth infrastructure • Need to make something up • Direct connections? • Lots of open connections, open ports
  23. Let’s say we did... • Security? • Skip existing auth infrastructure • Need to make something up • Direct connections? • Lots of open connections, open ports • Just not “web friendly”
  24. Philosophy High-level patterns API / Semantics libzmq
  25. Philosophy High-level patterns API / Semantics libzmq
  26. What do we want?
  27. What do we want? • Near feature/semantic parity with ZeroMQ
  28. What do we want? • Near feature/semantic parity with ZeroMQ • Throughput performance not as important
  29. What do we want? • Near feature/semantic parity with ZeroMQ • Throughput performance not as important • Embrace nature of the web in design
  30. What do we want? • Near feature/semantic parity with ZeroMQ • Throughput performance not as important • Embrace nature of the web in design • Single connection, service multiplexing
  31. What do we want? • Near feature/semantic parity with ZeroMQ • Throughput performance not as important • Embrace nature of the web in design • Single connection, service multiplexing • Use existing transports, protocols, etc
  32. NullMQ What do we want? • Near feature/semantic parity with ZeroMQ • Throughput performance not as important • Embrace nature of the web in design • Single connection, service multiplexing • Use existing transports, protocols, etc
  33. What do we have?
  34. WebSocket
  35. WebSocket • ZMTP over WebSocket?
  36. WebSocket • ZMTP over WebSocket? • Connection inefficient
  37. WebSocket • ZMTP over WebSocket? • Connection inefficient • Not extensible
  38. WebSocket • ZMTP over WebSocket? • Connection inefficient • Not extensible • No easy parsers
  39. WebSocket
  40. WebSocket • STOMP over WebSocket?
  41. WebSocket • STOMP over WebSocket? • Existing parsers, easy to write
  42. WebSocket • STOMP over WebSocket? • Existing parsers, easy to write • Very much like HTTP
  43. WebSocket • STOMP over WebSocket? • Existing parsers, easy to write • Very much like HTTP • Used primarily to multiplex
  44. NullMQ
  45. var url = "ws://hostname/gateway"; var ctx = new nullmq.Context(url); socket = ctx.socket(nullmq.REP); socket.bind("nullmq://echo"); socket.recvall(function(request) { socket.send("Got: "+request); });
  46. var url = "ws://hostname/gateway"; var ctx = new nullmq.Context(url); socket = ctx.socket(nullmq.REQ); socket.connect("nullmq://echo"); socket.send("Hello world!"); socket.recv(function(reply) { console.log(reply); // "Got: Hello world!" });
  47. Browser Server Application Application NullMQ NullMQ STOMP STOMP WebSocket WebSocket
  48. Browser Gateway Backend Application Bridge ZMQ Socket NullMQ NullMQ ZMQ Socket STOMP STOMP ZMQ Socket WebSocket WebSocket
  49. Presence Demo
  50. NullMQ http://github.com/progrium/nullmq http://groups.google.com/group/nullmq @progrium @avalanche123
  51. STOMP
  52. STOMP • Simple and human-readable like HTTP
  53. STOMP • Simple and human-readable like HTTP • Extensible via headers
  54. STOMP • Simple and human-readable like HTTP • Extensible via headers • Library and server support
  55. STOMP • Simple and human-readable like HTTP • Extensible via headers • Library and server support • An easy WebSocket subprotocol
  56. STOMP • Simple and human-readable like HTTP • Extensible via headers • Library and server support • An easy WebSocket subprotocol • Can be used to model “virtual connections”
  57. STOMP • Simple and human-readable like HTTP • Extensible via headers • Library and server support • An easy WebSocket subprotocol • Can be used to model “virtual connections” • Transactions for multipart messages
  58. STOMP “Extensions” 1. Frames include socket type header 2. Header for “connect” or “bind” in SUBSCRIBE 3. Req-Rep messages use “reply-to” header
Advertisement