andrewvc / dripdrop Goto Github PK
View Code? Open in Web Editor NEWExperimental Swiss Army Knife of Network Concurrency, ZeroMQ, EventMachine, WebSockets, HTTP, and More
License: MIT License
Experimental Swiss Army Knife of Network Concurrency, ZeroMQ, EventMachine, WebSockets, HTTP, and More
License: MIT License
Hello, i was wondering if there is a way of answer a rq from a separate nodelet. I'm trying to replicate the mongrel2 zmq behaviour using multiple "workers"
I'm unhappy with nodelet class interface as it stands now, I'm thinking of ways to fix it. Here's some ideas, I'd like some feedback.
As it stands now, you declare your nodelet class, and can optionally include a #configure method, which gets called on initialization. This interacts awkwardly when combined with Node#nodelet do; #block stuff; end. Proposed new interface:
class MyNodelet < DripDrop::Node::Nodelet
def pre_action
end
def action
end
def post_action
end
end
given this new system, when you call say nodelet :mynodelet, MyNLetClass {|nlet| ... }
what would happen is:
All of the pre/post/action methods would be optional.
This all dovetails with the new Node#run_list setting quite well, as having a standard #action method means you don't manually have to kick-off your nodelets later.
dripdrop needs logging damnit, and debug messages letting you trace messages during dev.
Hi very interesting. Would you consider dropping use of Thread in node, or at least making it optional some require+include. Alternatives are, I think, reactor pattern, or observer pattern. Observer pattern is my interest. Not sure yet how it would best work, but it would be neater and make the asynchronous behavior explicit, without making it tricky (if properly constrained).
Open to such an approach?
Hey guys, I'd like to fix any weird inconsistencies in naming in the API prior to our next gem release in a couple of days. I already pushed one change (renamed websocket to websocket_server) but would like to know if you guys see any other oddities.
One big change I'm thinking of is renaming :on_recv to :on_receive (the old method would work, but be deprecated and print a warning to $stderr).
My reasoning is we should either have on_recv and send_msg, or on_receive and send_message. I'm favoring long names because other parts of the lib tend to use long names as well.
Thoughts?
websockets are the only stateful protocol dripdrop currently supports, and they're awkward, fix this.
After making rspec run on my 1.9.2 ruby I've realized some spec are broken.
Some of them are fixed using DripDrop::Node.error_handler instead of DripDrop::Node#error_handler. Patch is here: oruen/dripdrop@717e8870a574c1114dba5945e5d5c26f78a416a0
Others looks a little bit strange:
[oruen@192 dripdrop (master %=)]$ rspec spec/node/zmq_xrepxreq_spec.rb zmq xreq/xrep basic sending and receiving Expected message in at least 3 parts, got ["\x00\v\x97s^\x18 I\xCD\x81\xF8t\xBFd]\xA0a", "{\"name\":\"test-0\",\"head\":{\"message_class\":\"DripDrop::Message\",\"_dd/xctr\":1},\"body\":null}"]/Users/oruen/apps/my/dripdrop/lib/dripdrop/handlers/zeromq.rb:200:in `on_readable'
I'm using Ruby 1.9.2 and zmq from head at zeromq/zeromq2@29e0e7dbadfcd0bab70feee119bd7c5e623b38d4
I dont see a way i can publish within several nodelets, is this possible?
Keeping track of sockets in complex apps with dripdrop sucks. Maybe some sort of routing a la Rails routes would help? maybe it'd be terrible. A worthwhile experiment.
Thin's a great server, but it doesn't work with jruby. Boo. perhaps evma-httpserver?
sockets should be destroyable.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.