void SendToWebSocketServer(WebSocket websocket, string str) { if (websocket.State == WebSocketState.Open) { // 若該 websocket 是連線中 ... } }