question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Reverse protocol handling for WebSocketResource

See original GitHub issue

I have a set of unit tests (in https://github.com/warner/magic-wormhole) that recently started failing when I combine autobahn-0.13.1 and Twisted trunk. It looks like https://github.com/twisted/twisted/commit/4f9e36d8ad21f9d73369f4d506bab30f61c2ad71 (landed 29-Mar-2016) is where the problem started (that’s the first revision after Twisted-16.1.1 was branched off that causes my project’s tests to fail).

The commit says:

Merge hide-request-transport-8191-5: Hide the transport backing the HTTPChannel object from twisted.web Resource objects.

And my tests are using WebSocketResource to put a websocket on a specific URL. I haven’t tracked down the specific failure yet, but it seems like the server is having an internal error when the client attempts to connect to it, or the server isn’t accepting the connection at all.

The relevant Twisted bug is at https://twistedmatrix.com/trac/ticket/8191 .

When I get some time (maybe next week), I’ll figure out how to run autobahn’s test suite against various versions of Twisted and see what happens.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:55 (30 by maintainers)

github_iconTop GitHub Comments

2reactions
meejahcommented, Jul 8, 2016

@oberstet FWIW, I quickly rebased the patch from Twisted’s 3204 to Twisted trunk, and further hacked my example above so that it does self.transport.switchProtocol(..) and it works fine.

So, if that gets patched up and landed in twisted then potentially something like the hacked up MultiProtocol/MultiProtocolFactory (er, SwitchableProtocol I called it above) thing could also go into Twisted, and then all Autobahn would need is a factory-function that creates an appropriate instance of a MultiProtocolFactory (i.e. all the stuff I put in server2.py, and the predicates or something like them).

1reaction
glyphcommented, Jul 11, 2016

I only care about latency until WebSocket takes over.

My point about latency is that you may be serving both traditional-web-application and websocket/autobahn interfaces for the same application. I understand that you could do this a different way, but keeping all your services the same can really simplify deployment pipelines, and it’s definitely something that Twisted works hard to make possible, and Autobahn specifically allows for.

But, as @Lukasa explained - there’s no overhead beyond the initial TLS handshake for websocket connections anyway, since wss:// clients won’t advertise an ability to speak HTTP/2.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Reverse HTTP proxy over WebSocket in Go (Part 1)
A reverse HTTP proxy over WebSocket is a type of proxy server which uses the WebSocket protocol as a "tunnel" to pass TCP...
Read more >
koding/websocketproxy: WebSocket reverse proxy handler ...
Handler interface build on top of gorilla/websocket that you can plug into your existing Go webserver to provide WebSocket reverse proxy.
Read more >
Writing WebSocket servers - Web APIs | MDN
WebSocket servers are often separate and specialized servers (for load-balancing or other practical reasons), so you will often use a reverse proxy (such...
Read more >
Using NGINX as a WebSocket Proxy
Learn how to use NGINX as a reverse proxy and load balancer for WebSocket applications.
Read more >
The WebSocket protocol
The WebSocket protocol enables two-way communication between a client running untrusted code running in a controlled environment to a remote ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found