private void OnClosed(object sender, EventArgs e) { IsConnected = false; if (!IsReconnecting) { WSMgr.OnConnectStateChanged(BindAi, false); } }
public void Connect() { if (client.State == WebSocketState.Open) { IsConnected = true; WSMgr.OnConnectStateChanged(BindAi, true); return; } client.Open(); Thread.Sleep(1000); if (client.State != WebSocketState.Open) { return; } IsConnected = true; WSMgr.OnConnectStateChanged(BindAi, true); }