I was a question on StackOverflow yesterday about calling sendClose() to select clients from a router. I was going to try to answer that question but I couldn’t figure it out.
I took one of the basicrouter.py routers from the twisted examples. I used onJoin and onLeave to record the active sessions for this router. I then created a ‘adm.session.list’ rpc call to collect that data. When called, I return json with the session_id, authid, and the actual session (self) for the client.
I thought it would be a simple matter at this point to add another rpc call:
where I pass the session id and then kill the session. I can’t kill it. I saw an answer on SO indicating that sendClose() can be called from the WebSocketServerProtocol. How do I reference that? Most of he imports I do are from the wamp side of the fence. In the router main, I see:
I’ve attached the basicrouter.py code I was working with. How can I close the session from the router?
basicrouter.py (9.93 KB)