public WebSocketServerEvent Poll()
        {
            if (!isStarted)
            {
                throw new InvalidOperationException("Socket not started");
            }

            return(WebSocketServerConnectionBehaviour.Poll());
        }
        public WebSocketState GetState(ulong id)
        {
            if (!isStarted)
            {
                throw new InvalidOperationException("Socket not started");
            }

            return(WebSocketServerConnectionBehaviour.GetState(id));
        }
        public void Send(ulong id, ArraySegment <byte> payload)
        {
            if (!isStarted)
            {
                throw new InvalidOperationException("Socket not started");
            }

            WebSocketServerConnectionBehaviour.Send(id, payload);
        }
        public void Close(ulong id, DisconnectCode code = DisconnectCode.Normal, string reason = null)
        {
            if (!isStarted)
            {
                throw new InvalidOperationException("Socket not started");
            }

            WebSocketServerConnectionBehaviour.Close(id, code, reason);
        }
        public void Shutdown()
        {
            if (!isStarted)
            {
                throw new InvalidOperationException("Socket not started");
            }

            isStarted = false;

            WebSocketServerConnectionBehaviour.Reset();

            webSocketServer.Stop();
        }