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&#39;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?<div>
<br></div><div>In my own experiments, I&#39;ve modified &quot;portforward.py&quot; 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.</div>
<div><br></div><div>Does anyone have a better suggestion for how to mount different protocol handlers on the same port?</div><div><br></div><div>Thanks.  -T</div><div><br></div><div>   ========</div><div><div>   site1 = twisted.web.server.Site(...)</div>
<div>   site2 = txws.WebSocketFactory(...)</div><div><br></div><div>   reactor.listenUNIX(&quot;site1.sck&quot;, site1)</div><div>   reactor.listenUNIX(&quot;site2.sck&quot;, site2)</div><div><br></div><div>   # this routes requests on port 80 to one of the two sockets</div>
<div>   reactor.listenTCP(80, InspectingProxyFactory(&quot;site1.sck&quot;, &quot;site2.sck&quot;)</div><div>   =======</div></div><div>  </div>