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); } }
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); }
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); }