Is there a good way to mount both an HTTP Site and a WebSocket Server on port 80?

Tom Sheffler <[email protected]>
Newsgroups gmane.comp.python.twisted.web
Message-ID <CAMBtMcvdBLX5kErHh=Lqu_nbUAdwwe8M0eWeZum3dPvoadx_=A@mail.gmail.com>
I was wondering about ways to mount different types of protocol handlers on
the same port.  It looks like there will be new WebSocket support
implementing a websocket Site.  We'll also have the existing HTTP Site.
 Will they both be able to live on port 80?  Is it important to be able to
do this?

In my own experiments, I've modified "portforward.py" to inspect an
incoming request and dispatch to one of two different servers mounted on
Unix-Domain sockets,  depending on the request path in the header.  It
looks something like the code below.  This does a lot of copying of each
data packet, but seems to be effective.

Does anyone have a better suggestion for how to mount different protocol
handlers on the same port?

Thanks.  -T

   ========
   site1 = twisted.web.server.Site(...)
   site2 = txws.WebSocketFactory(...)

   reactor.listenUNIX("site1.sck", site1)
   reactor.listenUNIX("site2.sck", site2)

   # this routes requests on port 80 to one of the two sockets
   reactor.listenTCP(80, InspectingProxyFactory("site1.sck", "site2.sck")
   =======

_______________________________________________
Twisted-web mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.