WebSocket and RPC at the same time

19 views
Skip to first unread message

Ahmet Uludağ

unread,
May 26, 2014, 1:11:20 PM5/26/14
to autob...@googlegroups.com
Hi,

I'd like to send/receive messages via WebSockets and use RPC [via wamp] at the same time.
So I tried to combine two examples; 'basic/rpc/timeservice' and 'websocket/echo' (by altering transport_factory.protocol). Although it gained WebSockets functionality RPC is broken. Is there any example code for this case ?


(ps:  since i couldn't find much info about this case, i'm wondering is it rare or else wrong to use both on the same port ?)



Thanks,

Ahmet

Tobias Oberstein

unread,
May 26, 2014, 1:22:17 PM5/26/14
to autob...@googlegroups.com
Hi Ahmet ,

Am 26.05.2014 19:11, schrieb Ahmet Uludağ:
> Hi,
>
> I'd like to send/receive messages via WebSockets and use RPC [via wamp]
> at the same time.
> So I tried to combine two examples; 'basic/rpc/timeservice' and
> 'websocket/echo' (by altering /transport_factory.protocol/). Although it

Alterting Autobahn internals is not recommended;)

> gained WebSockets functionality RPC is broken. Is there any example code
> for this case ?

Yes, this is possible in 3 ways:

1) Run both things on different ports under 1 server.

2) Run both things on 1 port under 1 server:

https://github.com/tavendo/AutobahnPython/tree/master/examples/twisted/websocket/multiproto
https://github.com/tavendo/AutobahnPython/blob/master/examples/twisted/websocket/multiproto/server1.py

3) Run both things on 1 port under 1 server by virtue of Twisted Web
resource hierarchies

https://github.com/tavendo/AutobahnPython/blob/master/examples/twisted/websocket/multiproto/server2.py

==

In general, I'd recommend either 1) or 3) ..

Hope this helps,
/Tobias

>
>
> (ps: since i couldn't find much info about this case, i'm wondering is
> it rare or else wrong to use both on the same port ?)
>
>
>
> Thanks,
>
> Ahmet
>
> --
> You received this message because you are subscribed to the Google
> Groups "Autobahn" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to autobahnws+...@googlegroups.com
> <mailto:autobahnws+...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.

Ahmet Uludag

unread,
May 26, 2014, 1:41:21 PM5/26/14
to autob...@googlegroups.com
Thank you for your lightning-fast response! I think I'll go with the third option which seems better for me.

Ahmet



For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "Autobahn" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/autobahnws/gI_1NLsph_4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to autobahnws+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages