NullMQ @ PDX

Post on 01-Sep-2014

7.506 views 2 download

Tags:

description

 

Transcript of NullMQ @ PDX

NullMQZEROMQ SEMANTICS IN THE BROWSER

Jeff Lindsay@progrium

Bulat Shakirzyanov@avalanche123

libzmq

libzmq

High-level patterns

libzmq

High-level patterns

Philosophy

libzmq

High-level patterns

Philosophy

libzmq

High-level patterns

Philosophy

API / Semantics

Toolkit for building messaging systems...

Toolkit for building messaging systems...

...behind your firewall

Toolkit for building messaging systems...

...behind your firewall

...not for customers

Toolkit for building messaging systems...

...behind your firewall

...not for customers

...certainly not with the browser

BUILDAPPS THAT COMMUNICATEWITH VOICE & SMS

twilio is a RESTful API for making & receiving voice calls over phones and VOIP, as well as sending & receiving text messages.

Using your existing web languages and infrastructure, you can build phone, SMS, and VOIP into your apps.

With just a single line of code, you can make the phone in your pocket ring.

Get started now with a free trial:

www2.twilio.com/pycon2012

MAKE & RECEIVEPHONE CALLS

SEND & RECEIVETEXT MESSAGES

INSTANTLY BUYPHONE NUMBERS

ADD VOICE TOWEB & MOBILE APPS

Browser Browser

ZeroMQ in the browser?

ZeroMQ in the browser?

• libzmq is a C++ library

ZeroMQ in the browser?

• libzmq is a C++ library

• Browser extension not viable

ZeroMQ in the browser?

• libzmq is a C++ library

• Browser extension not viable

• ZMTP is not valuable by itself

Let’s say we did...

• Security?

Let’s say we did...

• Security?

• Skip existing auth infrastructure

Let’s say we did...

• Security?

• Skip existing auth infrastructure

• Need to make something up

Let’s say we did...

• Security?

• Skip existing auth infrastructure

• Need to make something up

• Direct connections?

Let’s say we did...

• Security?

• Skip existing auth infrastructure

• Need to make something up

• Direct connections?

• Lots of open connections, open ports

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”

Let’s say we did...

libzmq

High-level patterns

Philosophy

API / Semantics

libzmq

High-level patterns

Philosophy

API / SemanticsAPI / Semantics

What do we want?

What do we want?

• Near feature/semantic parity with ZeroMQ

What do we want?

• Near feature/semantic parity with ZeroMQ

• Throughput performance not as important

What do we want?

• Near feature/semantic parity with ZeroMQ

• Throughput performance not as important

• Embrace nature of the web in design

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

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

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

NullMQ

What do we have?

WebSocket

WebSocket

• ZMTP over WebSocket?

WebSocket

• ZMTP over WebSocket?

• Connection inefficient

WebSocket

• ZMTP over WebSocket?

• Connection inefficient

• Not extensible

WebSocket

• ZMTP over WebSocket?

• Connection inefficient

• Not extensible

• No easy parsers

WebSocket

WebSocket

• STOMP over WebSocket?

WebSocket

• STOMP over WebSocket?

• Existing parsers, easy to write

WebSocket

• STOMP over WebSocket?

• Existing parsers, easy to write

• Very much like HTTP

WebSocket

• STOMP over WebSocket?

• Existing parsers, easy to write

• Very much like HTTP

• Used primarily to multiplex

NullMQ

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);});

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!"});

WebSocket

STOMP

NullMQ

Application

Browser

WebSocket

STOMP

NullMQ

Application

Server

WebSocket

STOMP

NullMQ

Application

Browser

WebSocket

STOMP

NullMQ

Bridge

Gateway Backend

ZMQ Socket

ZMQ Socket

ZMQ Socket

Presence Demo

NullMQ

http://github.com/progrium/nullmq

http://groups.google.com/group/nullmq

@progrium

@avalanche123

STOMP

STOMP• Simple and human-readable like HTTP

STOMP• Simple and human-readable like HTTP

• Extensible via headers

STOMP• Simple and human-readable like HTTP

• Extensible via headers

• Library and server support

STOMP• Simple and human-readable like HTTP

• Extensible via headers

• Library and server support

• An easy WebSocket subprotocol

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”

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

STOMP “Extensions”

1. Frames include socket type header

2. Header for “connect” or “bind” in SUBSCRIBE

3. Req-Rep messages use “reply-to” header