Ejemplo n.º 1
0
 public void Stop()
 {
     if (SocketBase != null)
     {
         threadReConnect.Abort();
         threadReConnect = null;
         RemoveChannel();
         SocketBase.stop();
         SocketBase    = null;
         SocketService = null;
     }
 }
Ejemplo n.º 2
0
        public void Start()
        {
            if (SocketBase == null)
            {
                SocketService = new WebSocketImpl();
                SocketBase    = new WebSocketBase(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();
            }
        }