movitto / rjr

Ruby JSON-RPC Library - json-rpc server/client mechanisms over amqp, websockets, and other transports, written in ruby
Apache License 2.0
68 stars 9 forks source link

compatibility rack #2

Open francescoagati opened 12 years ago

francescoagati commented 12 years ago

is compatible with rack or must run in a separated process if i want to use with async sinatra and rainbows? if i want to use with rails and activerecord in a separate process i must use async mysql2 feature (with event machine)?

movitto commented 12 years ago

Hrm I haven't tried integrating it with rack but it should be possible, it uses the vanilla EventMachine in the standard fashion to process requests. The only question would be the correct integration point, a new node could be created to use the rack / eventmachine interface to satisfy requests instead of a more lower level webserver. Or alternatively the dispatcher hierarchy can be abstracted a bit so that the developer may opt to dispatch requests to registered handlers (as it does now) or to a rack based interface.

As far as using it in a separate process, again I imagine this is something that could be easily solved with a new node or dispatcher type (nodes are what map the JSON-RPC requests to the underlying transport mechanism and the dispatchers route the requests to the handlers which satisfy them)

Perhaps we can flush something out together if I have a clearer picture of what you are trying to do. What is this for? How do you want to invoke your server and integrate JSON-RPC into those requests?

francescoagati commented 12 years ago

the situation where use json-rpc is an application rails 3.2 and 2 process:

all 2 process share the same code of rails enviroment

movitto commented 12 years ago

Hey ya if I understand what you're going for, I imagine rjr could be extended to support dispatching requests via rack to a rails app. As mentioned your best bet for integration would be to define a new dispatcher so that http, websocket, and other requests can be dispatched to a rack-compliant interface.

-Mo