public bool ServerDisconnect(long connectionId)
        {
#if !UNITY_WEBGL
            // WebSocket Server Disconnect
            if (!webSocketSecure)
            {
                if (wsServer != null && wsServer.Disconnect(connectionId))
                {
                    return(true);
                }
            }
            else
            {
                if (wssServer != null && wssServer.Disconnect(connectionId))
                {
                    return(true);
                }
            }

            // LiteNetLib Server Disconnect
            if (IsServerStarted && serverPeers.ContainsKey(connectionId))
            {
                Server.DisconnectPeer(serverPeers[connectionId]);
                serverPeers.Remove(connectionId);
                return(true);
            }
#endif
            return(false);
        }
Beispiel #2
0
        public bool ServerDisconnect(long connectionId)
        {
#if !UNITY_WEBGL || UNITY_EDITOR
            if (!secure)
            {
                return(wsServer != null && wsServer.Disconnect(connectionId));
            }
            else
            {
                return(wssServer != null && wssServer.Disconnect(connectionId));
            }
#else
            return(false);
#endif
        }