Beispiel #1
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 #2
0
        void ConnectWebsocket()
        {
            if (State != SubSystemState.Connected)
            {
                return;
            }

            if (_socket == null)
            {
                SetupSocket();
            }

            if (_socket.State < Net.WebSocketState.Connecting)
            {
                _socket.ConnectAsync(_url, Hub.Instance.Config.PushManagerConfig.Protocol, null);
            }
        }