public void Bind(WebSocket socket, SessionManager sessions) { _socket = socket; _sessions = sessions; defaultBind(); _socket.OnOpen += OnOpen; _socket.OnMessage += OnMessage; _socket.OnError += OnError; _socket.OnClose += OnClose; IsBound = true; }
/// <summary> /// Binds the specified <see cref="WebSocket"/> and <see cref="SessionManager"/> /// to a <see cref="WebSocketService"/> instance. /// </summary> /// <param name="socket"> /// A <see cref="WebSocket"/> to bind to the WebSocketService. /// </param> /// <param name="sessions"> /// A <see cref="SessionManager"/> to bind to the WebSocketService. /// </param> public void Bind(WebSocket socket, SessionManager sessions) { if (IsBound) return; _socket = socket; _sessions = sessions; _socket.OnOpen += onOpen; _socket.OnMessage += onMessage; _socket.OnError += onError; _socket.OnClose += onClose; IsBound = true; }