c# - Using websocket-sharp for .NET how can the server close a WebSocketBehavior? -


i'm trying use websocket-sharp project , server needs able drop websocket connections.

the connections represented websocketbehavior class inherit from. there's no stop or close or disconnect method on websocketbehavior. closest find is

websocketbehavior.context.websocket.close 

so tried adding method overriding class

public class mysocket : websocketbehavior {     public void close()     {         base.context.websocket.close();     } } 

but causes error when logging turned on

2/5/2016 7:08:25 pm|error|websocket.close|this operation isn't available in: closed 

how can server disconnect/close websocket connection?

as stated ticket in their repo

you need close related session:

 sessions.closesession(id); 

edit:

it same code op called through correct abstractions, should work in theory, fact tries access stuff "low level", made me suspect access other internal functionality bypassing "public method" wich results in wrong behaviour (like stuff called "public methods" no longer working, suggest access proper abstractions in order avoid problems, after if problem persist should make ticket asking bugfix in original repository. such bug cannot fixed there becuse require aware of other code written you.

after should track both client , server side log file discover happens, in example connection closed client (as stated evk in comments)


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -