Two Way RPC

#1

I'm still fairly new to network programming, so, apologies in advance.

I've got a (turn-based) game engine written in Python, and I'd like to
write a frontend to it in a <canvas> element. I'd need to be able to
have the game engine ask the JS frontend to call methods (for things
like asking the user to perform menu selections to return to the game
engine, show message prompts, etc.) and then also have the JS side
call methods on the game engine to perform the game mechanics.

From the small bit I've read, I think I've learned that websockets is
more suitable for this kind of two-way non-solicited communication
than what I was originally considering (an XMLRPC / JSONRPC server
+client on each side), but more specifically, is there an easy way to
do this using Autobahn's WAMP to expose methods on each side, or, as
it appears, do I only get to pick the Python side with WAMP, so I
might as well just start from scratch?

Cheers,
Julian

0 Likes

#2

WS is they way forward ... low-overhead, low-latency, standardized.

There is one caveat: depending on your timeline, IE will likely get
production/builtin support for WS only when IE10 is released, which
might be 2012.

Today, for sane support, you have: FF >= 7 and Chrome >= 14.

Note, that FF is also there for mobiles .. i.e. FF8 works WS like a
charm on Android (>= ARM A8)

···

==

Regarding Autobahn and WAMP ... no, there is Python client + server,
but clients for JS (jQuery) and Android (Java).

Check out

http://www.tavendo.de/autobahn/tutorial/rpc.html
http://www.tavendo.de/autobahn/tutorial/pubsub.html

==

The way you "call methods on the client from server" with WAMP is:

Client subscribes to topic:

http://mygame.org/<player ID>/event#alertmsg

hook up your "show message box JS" to above topic, and then publish
and event to that topic
either from another client or from your server code.

Your game engine is your server. Your browsers are still clients.

With the RPC pattern : it's about clients calling well-known methods
on servers. Clients don't expose methods.

However the PubSub patterns allows you to do like in the example above.

===

If you allow me to suggest something: just give above tutorials a shot
and start experimenting.

Then see if that works for you or not ..

2011/10/23 Julian Berman <jul...@grayvines.com>:

I'm still fairly new to network programming, so, apologies in advance.

I've got a (turn-based) game engine written in Python, and I'd like to
write a frontend to it in a <canvas> element. I'd need to be able to
have the game engine ask the JS frontend to call methods (for things
like asking the user to perform menu selections to return to the game
engine, show message prompts, etc.) and then also have the JS side
call methods on the game engine to perform the game mechanics.

From the small bit I've read, I think I've learned that websockets is
more suitable for this kind of two-way non-solicited communication
than what I was originally considering (an XMLRPC / JSONRPC server
+client on each side), but more specifically, is there an easy way to
do this using Autobahn's WAMP to expose methods on each side, or, as
it appears, do I only get to pick the Python side with WAMP, so I
might as well just start from scratch?

Cheers,
Julian

0 Likes

#3

Cool. Will Do. Thanks!

0 Likes

#4

Note, that FF is also there for mobiles .. i.e. FF8 works WS like a
charm on Android (>= ARM A8)

Yes, but FF Mobile on Android lacks Flash support and is a horrible
browsing experience. I found that Opera Mobile has the best support,
but you need to enable websockets in the about:config.

···

On Oct 23, 6:28 pm, Tobias Oberstein <tobias.o...@gmail.com> wrote:

WS is they way forward ... low-overhead, low-latency, standardized.

There is one caveat: depending on your timeline, IE will likely get
production/builtin support for WS only when IE10 is released, which
might be 2012.

Today, for sane support, you have: FF >= 7 and Chrome >= 14.

Note, that FF is also there for mobiles .. i.e. FF8 works WS like a
charm on Android (>= ARM A8)

==

Regarding Autobahn and WAMP ... no, there is Python client + server,
but clients for JS (jQuery) and Android (Java).

Check out

http://www.tavendo.de/autobahn/tutorial/rpc.htmlhttp://www.tavendo.de/autobahn/tutorial/pubsub.html

==

The way you "call methods on the client from server" with WAMP is:

Client subscribes to topic:

http://mygame.org/<player ID>/event#alertmsg

hook up your "show message box JS" to above topic, and then publish
and event to that topic
either from another client or from your server code.

Your game engine is your server. Your browsers are still clients.

With the RPC pattern : it's about clients calling well-known methods
on servers. Clients don't expose methods.

However the PubSub patterns allows you to do like in the example above.

===

If you allow me to suggest something: just give above tutorials a shot
and start experimenting.

Then see if that works for you or not ..

2011/10/23 Julian Berman <jul...@grayvines.com>:

> I'm still fairly new to network programming, so, apologies in advance.

> I've got a (turn-based) game engine written in Python, and I'd like to
> write a frontend to it in a <canvas> element. I'd need to be able to
> have the game engine ask the JS frontend to call methods (for things
> like asking the user to perform menu selections to return to the game
> engine, show message prompts, etc.) and then also have the JS side
> call methods on the game engine to perform the game mechanics.

> From the small bit I've read, I think I've learned that websockets is
> more suitable for this kind of two-way non-solicited communication
> than what I was originally considering (an XMLRPC / JSONRPC server
> +client on each side), but more specifically, is there an easy way to
> do this using Autobahn's WAMP to expose methods on each side, or, as
> it appears, do I only get to pick the Python side with WAMP, so I
> might as well just start from scratch?

> Cheers,
> Julian

0 Likes

#5

Oh, ignore Opera, it's Hybi00.

···

On Oct 26, 5:38 am, "Daniel F." <sound...@gmail.com> wrote:

> Note, that FF is also there for mobiles .. i.e. FF8 works WS like a
> charm on Android (>= ARM A8)

Yes, but FF Mobile on Android lacks Flash support and is a horrible
browsing experience. I found that Opera Mobile has the best support,
but you need to enable websockets in the about:config.

On Oct 23, 6:28 pm, Tobias Oberstein <tobias.o...@gmail.com> > wrote:

> WS is they way forward ... low-overhead, low-latency, standardized.

> There is one caveat: depending on your timeline, IE will likely get
> production/builtin support for WS only when IE10 is released, which
> might be 2012.

> Today, for sane support, you have: FF >= 7 and Chrome >= 14.

> Note, that FF is also there for mobiles .. i.e. FF8 works WS like a
> charm on Android (>= ARM A8)

> ==

> Regarding Autobahn and WAMP ... no, there is Python client + server,
> but clients for JS (jQuery) and Android (Java).

> Check out

>http://www.tavendo.de/autobahn/tutorial/rpc.htmlhttp://www.tavendo.de...

> ==

> The way you "call methods on the client from server" with WAMP is:

> Client subscribes to topic:

>http://mygame.org/<player ID>/event#alertmsg

> hook up your "show message box JS" to above topic, and then publish
> and event to that topic
> either from another client or from your server code.

> Your game engine is your server. Your browsers are still clients.

> With the RPC pattern : it's about clients calling well-known methods
> on servers. Clients don't expose methods.

> However the PubSub patterns allows you to do like in the example above.

> ===

> If you allow me to suggest something: just give above tutorials a shot
> and start experimenting.

> Then see if that works for you or not ..

> 2011/10/23 Julian Berman <jul...@grayvines.com>:

> > I'm still fairly new to network programming, so, apologies in advance.

> > I've got a (turn-based) game engine written in Python, and I'd like to
> > write a frontend to it in a <canvas> element. I'd need to be able to
> > have the game engine ask the JS frontend to call methods (for things
> > like asking the user to perform menu selections to return to the game
> > engine, show message prompts, etc.) and then also have the JS side
> > call methods on the game engine to perform the game mechanics.

> > From the small bit I've read, I think I've learned that websockets is
> > more suitable for this kind of two-way non-solicited communication
> > than what I was originally considering (an XMLRPC / JSONRPC server
> > +client on each side), but more specifically, is there an easy way to
> > do this using Autobahn's WAMP to expose methods on each side, or, as
> > it appears, do I only get to pick the Python side with WAMP, so I
> > might as well just start from scratch?

> > Cheers,
> > Julian

0 Likes

#6

Opera currently only supports an old, outdated version of WS ("--00").
That protocol version has security issues, which is the reason you
have to explicitly enable it.

Autobahn does not support that protocol version, though there is a
fork which does

https://github.com/Metaswitch/AutobahnHackedForWebSocket00

Somewhat OT:

FF Mobile UX: I agree to a certain degree, it could be better, but I
think it's too harsh to call it horrible .. for me, the builtin
browser has the best UX.

Flash: sucks anyway. I don't care about Flash.

···

2011/10/26 Daniel F. <sound...@gmail.com>:

Note, that FF is also there for mobiles .. i.e. FF8 works WS like a
charm on Android (>= ARM A8)

Yes, but FF Mobile on Android lacks Flash support and is a horrible
browsing experience. I found that Opera Mobile has the best support,
but you need to enable websockets in the about:config.

On Oct 23, 6:28 pm, Tobias Oberstein <tobias.o...@gmail.com> > wrote:

WS is they way forward ... low-overhead, low-latency, standardized.

There is one caveat: depending on your timeline, IE will likely get
production/builtin support for WS only when IE10 is released, which
might be 2012.

Today, for sane support, you have: FF >= 7 and Chrome >= 14.

Note, that FF is also there for mobiles .. i.e. FF8 works WS like a
charm on Android (>= ARM A8)

==

Regarding Autobahn and WAMP ... no, there is Python client + server,
but clients for JS (jQuery) and Android (Java).

Check out

http://www.tavendo.de/autobahn/tutorial/rpc.htmlhttp://www.tavendo.de/autobahn/tutorial/pubsub.html

==

The way you "call methods on the client from server" with WAMP is:

Client subscribes to topic:

http://mygame.org/<player ID>/event#alertmsg

hook up your "show message box JS" to above topic, and then publish
and event to that topic
either from another client or from your server code.

Your game engine is your server. Your browsers are still clients.

With the RPC pattern : it's about clients calling well-known methods
on servers. Clients don't expose methods.

However the PubSub patterns allows you to do like in the example above.

===

If you allow me to suggest something: just give above tutorials a shot
and start experimenting.

Then see if that works for you or not ..

2011/10/23 Julian Berman <jul...@grayvines.com>:

> I'm still fairly new to network programming, so, apologies in advance.

> I've got a (turn-based) game engine written in Python, and I'd like to
> write a frontend to it in a <canvas> element. I'd need to be able to
> have the game engine ask the JS frontend to call methods (for things
> like asking the user to perform menu selections to return to the game
> engine, show message prompts, etc.) and then also have the JS side
> call methods on the game engine to perform the game mechanics.

> From the small bit I've read, I think I've learned that websockets is
> more suitable for this kind of two-way non-solicited communication
> than what I was originally considering (an XMLRPC / JSONRPC server
> +client on each side), but more specifically, is there an easy way to
> do this using Autobahn's WAMP to expose methods on each side, or, as
> it appears, do I only get to pick the Python side with WAMP, so I
> might as well just start from scratch?

> Cheers,
> Julian

0 Likes