Websocket proxying with custom middleware logic

24 views
Skip to first unread message

Mikko Ohtamaa

unread,
May 11, 2015, 10:11:44 AM5/11/15
to ws...@googlegroups.com
Hi,

I am looking for an option to build a Python-based websocket proxy with the following characteristics

* Easily run as a standalone Python process

* Accept incoming websocket connections

* Run some Python logic whether the connection is correctly authenticated, against external authenticator

* Proxy the connection to the upstream websocket server picked from a map

Looks like building a ws4py app is the way to go as it has both client and server functionality and is quite well established and documented. However, does there exist any prior examples or sample projects doing WebSocket proxying I can check before getting my hands dirty?

Cheers,
Mikko

Sylvain Hellegouarch

unread,
May 11, 2015, 10:19:25 AM5/11/15
to ws...@googlegroups.com
Hello Mikko,

Thanks for the kind words regarding ws4py. However, I can't say I've heard any such task undertaken using ws4py. Whether it's a good fit, I can't say but I'll be interested in any feedback you might provide. This is always helpful to the project. 

Note, have you considered Crossbar.io built on top of Autobahn?


Thanks,
--

Mikko Ohtamaa

unread,
May 12, 2015, 2:03:18 PM5/12/15
to ws...@googlegroups.com
Hi,


Thanks for the kind words regarding ws4py. However, I can't say I've heard any such task undertaken using ws4py. Whether it's a good fit, I can't say but I'll be interested in any feedback you might provide. This is always helpful to the project. 

I managed to get something working.

* Instead of using ws4py server, I am using uWSGI server for the downsteam connectivity

* The upstream connectivity is modified WebSocketBaseClient which crudely combines ws4py and uWSGI event loops

Full answer is here: http://stackoverflow.com/a/30198253/315168
 
Reply all
Reply to author
Forward
0 new messages