andrewvc / dripdrop

Experimental Swiss Army Knife of Network Concurrency, ZeroMQ, EventMachine, WebSockets, HTTP, and More
MIT License
144 stars 10 forks source link

Add routing layer #7

Closed andrewvc closed 14 years ago

andrewvc commented 14 years ago

DripDrop needs a routing layer. Juggling addresses is way too much a PITA. Let's see if I can hack this out tonight...

Things it should do:

It should look something like... route :chat_ws, :websocket, 'ws://127.0.0.1:1234' route :chat_in_zsub, :zmq_subscribe, :bind, 'tcp://127.0.0.1:12345'

So, it should pretty much just take a label, followed by the normal arguments used for constructing said socket. Then, it should magically make the socket. You'll be able to use the socket later by calling it by name.

So, given the routes above you could do:

chat_ws.on_recv {...}

Note, that including the abbreviated socket type in the route name is merely recommended, not required, but it's probably a good idea for sanity.

andrewvc commented 14 years ago

I think this came out nicely... Time will tell