Cant send messages on error and close channels with WebSocketSharp server

38 views Asked by At

I'm implementing socket server using WebSocketSharp.Server.WebSocketServer

I can send messages to clients by calling Broacast():

public void Broadcast(string message)
{
    if(_sessions != null && _sessions.Count > 0)
    {
        _sessions.Broadcast(message);
    }
}

_sessions are obtained from the underlying WebSocketBehavior instance supplied when starting the server

    public void Start(string uri)
    {
        uri = uri.StartsWith("/") ? uri : "/" + uri;
_server.AddWebSocketService<GenericServer>(uri, new Func<SocketBehavior>(()=> { return 
                                                          new SocketBehavior(this); }));
        _server.Start();
    }

Messages sent via Broadcast arrives the client on the message channel

My question is how to send message to the clients on the Error and the Close cannesl

0

There are 0 answers