class_docstr: A WebSocket connection.
  
  Call :meth:`connect` before :meth:`send` and :meth:`receive`.
  
  All methods are thread safe.
  
  Parameters
  ----------
  url
      The WebSocket URL.
      For tuner command channel it should be something like ``ws://localhost:8080/tuner``.
class_docstr_tok: ["A","WebSocket","connection",".","Call",":","meth",":","`","connect","`","before",":","meth",":","`","send","`","and",":","meth",":","`","receive","`",".","All","methods","are","thread","safe",".","Parameters","--","--","--","--","--","url","The","WebSocket","URL",".","For","tuner","command","channel","it","should","be","something","like","``","ws",":","\/\/localhost:8080\/tuner","``","."]
code: def __init__(self, url: str):
      self._url: str = url
      self._ws: Any = None
  
file_path: nni/nni/runtime/command_channel/websocket/connection.py
imports: from __future__ import annotations
  import asyncio
  import logging
  from threading import Lock, Thread
  from typing import Any, Type
  import websockets
  import nni
  from ..base import Command
label_desc: Use image node_id 1 to create a new WsConnection object  with example: obj = WsConnection(url)