JSON-RPC over TCP

1,047 views
Skip to first unread message

hwinkel

unread,
Aug 25, 2008, 3:58:53 PM8/25/08
to JSON-RPC
We are implementing JSON-RPC over HTTP for our Browser based
communication. Now we thinking about backend communicaton an wondering
JSON-RPC can be run directly on a TCP socket. I read JSON-RPC should
support that and in the Service Mapping Proposal this is mentioned as
well:

http://groups.google.com/group/json-schema/web/service-mapping-description-proposal

Where can I found more informations how to run JSON-RPC directly over
TCP sockets ? Anybody knows about implementations supporting JSON-RPC
over TCP ?

Thanks a lot,

hwinkel

Matt (MPCM)

unread,
Aug 25, 2008, 8:51:51 PM8/25/08
to JSON-RPC
You can easily run it over a socket.

I don't have an implementation to share, but I wrote a test one using
sockets in php a while back (using http://www.chabotc.com/phpsocketdaemon/
). The code really isn't any different that any other http
implementation in concept, which is really the beauty of json-rpc from
the get go. You should be able to pull something together pretty
quickly... if your are doing it bidirectional like the 1.0 suggests it
gets tougher, but if you stick with the client/server concept it
should be straightforward enough.

Perhaps you can share a little more about your environment?

--
Matt (MPCM)

hwinkel

unread,
Aug 26, 2008, 5:25:31 AM8/26/08
to JSON-RPC
Hi Matt,

We have implemented JSON-RPC in Lua and run it on embedded Hardware.
Browsers
can access the APIs via JSON-RPC over HTTP.

Now we think to provide the similar APIs to a "back end connection"
requested
by web portals (Java, PHP RoR etc) all of them should have JSON_RPC on
board.

for bidirectional communications and for higher speed we think about
removing
HTTP overhead and speak JSON-RPC over TCP sockets.

The problem is to find anything of this transport in the latest JSON-
RPC 2.0
spec. They even seems to have dropped a lot of infomations available
in
the older 1.0 documents, Or I'm just unable to find them. Is ther any
reliable source for JSON specs. ?

Thanks a lot,

hwinkel

On Aug 25, 8:51 pm, "Matt (MPCM)" <WickedLo...@gmail.com> wrote:
> You can easily run it over a socket.
>
> I don't have an implementation to share, but I wrote a test one using
> sockets in php a while back (usinghttp://www.chabotc.com/phpsocketdaemon/

Roland Koebler

unread,
Aug 26, 2008, 6:02:39 AM8/26/08
to json...@googlegroups.com
hi,

> for bidirectional communications and for higher speed we think about
> removing HTTP overhead and speak JSON-RPC over TCP sockets.

yes, that's reasonable ;).

by the way, I've written a very modular json-rpc (v1.0 + v2.0) implementation
in python, which works over TCP, unix domain sockets and probably with any
other transport.
I'm planning to release it soon, but if you would like to see it before,
tell me, and I'll send you the code.

> The problem is to find anything of this transport in the latest JSON-
> RPC 2.0 spec. They even seems to have dropped a lot of infomations available
> in the older 1.0 documents, Or I'm just unable to find them. Is ther any
> reliable source for JSON specs. ?

the json-rpc specification and its transports are independent.
json-rpc should work with *any* transport: simple tunnel your
json-rpc-string through your preferred transport.

this is extremely easy for sockets. for HTTP, there are some suggestions
in the following proposal (although this proposal seems not to be up to
date concerning the json-rpc spec):
http://groups.google.com/group/json-rpc/web/json-rpc-over-http


regards,
Roland

Matt (MPCM)

unread,
Aug 27, 2008, 4:34:07 PM8/27/08
to JSON-RPC
Roland,

Would you mind sending off a copy of the python version to me as well
(ma...@mpcm.com)?

I am going to finalize the 2.0 implementation I have in php and get it
up somewhere also. Been busy with other projects, but it is well past
time that it should be posted somewhere. I'm been playing with
different styles of method/function mapping and am just trying to
figure out what makes the most sense.

--
Matt (MPCM)

Matthew Weier O'Phinney

unread,
Aug 27, 2008, 5:19:13 PM8/27/08
to json...@googlegroups.com

I'm getting in on this thread late... I've created a JSON-RPC
implementation for Zend Framework that supports 1.0 and 2.0 already; it
currently works over HTTP, but it would be trivial to create
request/response objects for other environments.

It's stable, though it hasn't been released in a stable version of ZF
yet. You can grab it from the current 1.6.0RC3 package, or current ZF
SVN trunk.

Feel free to ping me if you have any questions.

--
Matthew Weier O'Phinney
mweiero...@gmail.com
http://weierophinney.net/matthew/

Jorge Vargas

unread,
Aug 28, 2008, 3:58:40 AM8/28/08
to json...@googlegroups.com

I actually did this a long time ago as an experiment, I got a patch somewhere against the current implementation at http://json-rpc.org it never went to production but it worked.


Thanks a lot,

hwinkel


Matt (MPCM)

unread,
Aug 28, 2008, 7:29:14 AM8/28/08
to JSON-RPC
On Aug 27, 5:19 pm, "Matthew Weier O'Phinney"
<mweierophin...@gmail.com> wrote:
> It's stable, though it hasn't been released in a stable version of ZF
> yet. You can grab it from the current 1.6.0RC3 package, or current ZF
> SVN trunk.


I checked it out last nite and took a quick look, I definitely will
recommend the ZF version as the standard json-rpc server for php. I
didn't actually use it, but it looks good. Glad to see it in the ZF,
thank you for your work on this. :)

I'll still post the version I have for those looking for an
alternative way to get json-rpc up and running without having to
include ZF. I'll post once it up on the net.

--
Matt (MPCM)
Reply all
Reply to author
Forward
0 new messages