Break A Websocket Connection (on server) Immediately

#1

Hi folks,

I’m using Autobahn|Python with Twisted, so this may be a Twisted-specific question. How can I close a WebSocket connection immediately? If there are messages coming in quick succession from a client, all of those messages will finish regardless if I call self.sendClose(), or self.transport.loseConnection() (from a WebSocketServerProtocol instance).

I’m attempting to track the “heat” of a WebSocket by incrementing a heat counter as messages come in. The heat cools off at some rate. If the connection gets too hot, I want to slam it shut.

0 Likes