public void Connect() { this.RedSocketStatus = RedSocketStatus.Opening; WebSocket = new WebSocket(this.SocketUrl); if (OnOpen != null) { WebSocket.OnOpen += OnOpenIn; } if (OnMessage != null) { WebSocket.OnMessage += OnMessageIn; } if (Onclose != null) { WebSocket.OnClose += OncloseIn; } if (OnError != null) { WebSocket.OnError += OnErrorIn; } WebSocket.Connect(); }
private void OnOpenIn(object sender, EventArgs e) { this.RedSocketStatus = RedSocketStatus.Opened; if (OnOpen != null) { OnOpen(sender, e); } }
private void OncloseIn(object sender, CloseEventArgs e) { this.RedSocketStatus = RedSocketStatus.Closing; if (Onclose != null) { Onclose(sender, new RedWebSocketCloseEventArgs(e.Code, e.Reason, e.WasClean)); } this.RedSocketStatus = RedSocketStatus.Closed; }