Пример #1
0
        void ClientDisConnected(Fleck.IWebSocketConnection socket)
        {
            //Heartbeat heartbeat = new Heartbeat(key);
           // heartbeats.Add(key, heartbeat);
            //long key = socket.Handle.ToInt64();
            //if (clientHeartbeats.ContainsKey(key))
            //    clientHeartbeats.Remove(key);
            long sock = socket.GetHashCode();

            if (myGlobals.ClientServer.ContainsKey(socket))
            {
                Socket serverSock = myGlobals.ClientServer[socket];
                //PublishMessage(logBox1, string.Format("Client {0}(socket:{1}) has been disconnected!", socket.ConnectionInfo, sock));
                closeClient(socket);
                closeServer(serverSock);
            }
            else
            {
               // PublishMessage(logBox1, string.Format("Client {0}(socket:{1}) has been disconnected!", socket.ConnectionInfo, sock));
                closeClient(socket);
            }
        }
Пример #2
0
        public void sendMsgToClient2(string msg, Fleck.IWebSocketConnection clientSock, GlobalMessage msgType)
        {
            long sock = clientSock.GetHashCode();
            //toClient.DistributeMessage(bytes, clientSock);
            wsServer.sendMessage(clientSock, msg);
            PublishMessage(logBox1, string.Format("Client {0}(socket:{1}) has been disconnected!", clientSock.ConnectionInfo,sock));
          //  toClient.Close(clientSock);
            wsServer.closeConnection(clientSock);
            wsServer.allSockets.Remove(clientSock);

        }
Пример #3
0
        void ClientConnected(Fleck.IWebSocketConnection socket)
        {
            long sock = socket.GetHashCode();
            PublishMessage(logBox1, string.Format("Client {0}(socket:{1}) has been connected!", socket.ConnectionInfo, sock));

            //long key = socket.Handle.ToInt64();
            //Heartbeat clientTimer = new Heartbeat();
            //clientTimer.timeout += new Heartbeat.timerDelegate(clientTimeout);
           // clientHeartbeats.Add(key, clientTimer);

        }