[Zope-dev] WebSockets API

Alex Leach albl500 at york.ac.uk
Wed Nov 28 10:57:35 UTC 2012


Hi, just sending again to the list...

On Tuesday 27 Nov 2012 16:51:13 Andreas Jung wrote:
> Use the right tool for each problem. Zope is really not the right choice
> for implementing a websocket server. 

Why is it the wrong tool for the job? I read up a bit on asyncore, and see 
it's supposedly a single threaded server. Is that part of the problem?

The way I see it, zope's got its own web server and framework that handles 
HTTP requests; WebSockets initially connect over HTTP, before upgrading to a 
WebSocket connection. If the 'upgrade' request was recognised by zope, then 
couldn't it just forward the connection on to any WebSocket server? It 
wouldn't even need to do the handshake, but a compatible proxy would no doubt 
need to be implemented.


> There are dozens of better solutions for Python like
> 
> http://autobahn.ws/

The dependencies of all other Python-based WebSocket implementations all 
require a completely different application stack. Twisted, which autobahn 
uses, looks very powerful for low-level networking and the such, but it's a 
beast and I've never used it before, in favour of making templated web apps 
with grok..

Also, wouldn't the front-end socket of autobahn conflict with any other 
running HTTP server? Sure, I could set it up on an alternative port, and use a 
front-end webserver to proxy requests appropriately, based on URL paths and 
patterns, like I do now with grok and Apache. But that adds another two 
complications, when it comes to initially setting up the server. Installation 
instructions for potential users would become even more off-putting than they 
already are.

The zope server already has a good system for URL parsing and dispatching. 
Would zope.proxy be any good at proxying WebSocket requests based on the URL?

> 
> Don't try to misuse a framework for a purpose that it has not been
> invented for.

WebSockets hadn't been invented back then, but HTTP was always meant to be 
bidirectional. Get with the times :b  (jk)

So, I think I understand that zope might not be great for managing 
simultaneous bidirectional traffic, which is basically a requirement of a 
WebSocket server. Could it not be a good proxy either?

KR,
Alex


More information about the Zope-Dev mailing list