class_docstr: Implements a custom Tornado WebSocketHandler for the Bokeh Server.
  
      
code: def __init__(self, tornado_app, *args, **kw) -> None:
      self.receiver = None
      self.handler = None
      self.connection = None
      self.application_context = kw["application_context"]
      self.latest_pong = -1
      # write_lock allows us to lock the connection to send multiple
      # messages atomically.
      self.write_lock = locks.Lock()
  
      self._token = None
  
      self._compression_level = kw.pop("compression_level", None)
      self._mem_level = kw.pop("mem_level", None)
  
      # Note: tornado_app is stored as self.application
      super().__init__(tornado_app, *args, **kw)
  
imports: from __future__ import annotations
  import logging
  import calendar
  import datetime
  from typing import TYPE_CHECKING, Any, cast
  from urllib.parse import urlparse
  from tornado import locks, web
  from tornado.websocket import WebSocketClosedError, WebSocketHandler
  from bokeh.settings import settings
  from bokeh.util.token import check_token_signature, get_session_id, get_token_payload
  from ...protocol import Protocol
  from ...protocol.exceptions import MessageError, ProtocolError, ValidationError
  from ...protocol.message import Message
  from ...protocol.receiver import Receiver
  from ...util.dataclasses import dataclass
  from ..protocol_handler import ProtocolHandler
  from .auth_request_handler import AuthRequestHandler
label_desc: Use image node_id 1 to create a new WSHandler object from inherited base classes: AuthRequestHandler, WebSocketHandler with example: obj = WSHandler(tornado_app)