예제 #1
0
 public void Stop()
 {
     if (SocketBase != null)
     {
         threadReConnect.Abort();
         threadReConnect = null;
         RemoveChannel();
         SocketBase.stop();
         SocketBase    = null;
         SocketService = null;
     }
 }
예제 #2
0
        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();
            }
        }