public void Stop() { if (SocketBase != null) { threadReConnect.Abort(); threadReConnect = null; RemoveChannel(); SocketBase.stop(); SocketBase = null; SocketService = null; } }
public void Start() { if (SocketBase == null) { SocketService = new WebSocketImpl(); SocketBase = new WebSocketBaseOKCoin(SelectedUrl, SocketService as WebSocketService); SocketBase.start(); //var dict = new Dictionary<string, string>(); //dict.Add("api_key", ConfigInfo.apiKey); //wsb.send("{\"event\":\"login\",\"parameters\":{\"api_key\":\"" + ConfigInfo.apiKey + "\",\"sign\":\"" + SignParams(dict) + "\"}}");//登录 threadReConnect = new Thread(new ThreadStart(Reconnect)) { IsBackground = true }; threadReConnect.Start(); } }