Beispiel #1
0
 public override void Disconnect(bool now)
 {
     if (_socket != null)
     {
         _socket.Dispose();
         _socket = null;
         DispatchDisconnect(string.Empty);
     }
 }
Beispiel #2
0
 public override void Disconnect(bool isLogout)
 {
     State = SubSystemState.Disconnected;
     if (_socket != null)
     {
         _socket.Dispose();
         _socket = null;
     }
 }
Beispiel #3
0
        public override void Connect(string url, uint connId)
        {
            // convert connId into sec key
            EB.Debug.Log("Connecting to " + url);
            var key = System.BitConverter.GetBytes(connId);

            _socket            = new Net.WebSocket();
            _socket.OnData    += OnSocketReceive;
            _socket.OnConnect += OnSocketConnect;
            _socket.OnError   += OnSocketError;
            _socket.ConnectAsync(new EB.Uri(url), "io.sparx.game", key);
        }
Beispiel #4
0
        void SetupSocket()
        {
            if (_socket != null)
            {
                _socket.Dispose();
            }

            _socket            = new Net.WebSocket();
            _socket.OnConnect += OnConnect;
            _socket.OnError   += OnError;
            _socket.OnMessage += OnMessage;
        }
Beispiel #5
0
        public override void OnEnteredForeground()
        {
            if (_socket != null)
            {
                _socket.Dispose();
                _socket = null;
            }

            _deffered.Dispose();

            ConnectWebsocket();

            CleanNotification();
        }
Beispiel #6
0
        public override void OnEnteredBackground()
        {
            if (_socket != null)
            {
                _socket.Dispose();
                _socket = null;
            }

            _deffered.Dispatch();

            if (OnScheduleLocalNotification != null)
            {
                OnScheduleLocalNotification();
            }
        }