code: async def open(self, port, proxied_path=''):
          
          if not proxied_path.startswith('/'):
              proxied_path = '/' + proxied_path
  
          client_uri = self.get_client_uri('ws', port, proxied_path)
          headers = self.request.headers
  
          def message_cb(message):
              """
              Callback when the backend sends messages to us
  
              We just pass it back to the frontend
              """
              # Websockets support both string (utf-8) and binary data, so let's
              # make sure we signal that appropriately when proxying
              self._record_activity()
              if message is None:
                  self.close()
              else:
                  self.write_message(message, binary=isinstance(message, bytes))
  
          def ping_cb(data):
              """
              Callback when the backend sends pings to us.
  
              We just pass it back to the frontend.
              """
              self._record_activity()
              self.ping(data)
  
          async def start_websocket_connection():
              self.log.info('Trying to establish websocket connection to {}'.format(client_uri))
              self._record_activity()
              request = httpclient.HTTPRequest(url=client_uri, headers=headers)
              self.ws = await pingable_ws_connect(request=request,
                  on_message_callback=message_cb, on_ping_callback=ping_cb)
              self._record_activity()
              self.log.info('Websocket connection established to {}'.format(client_uri))
  
          ioloop.IOLoop.current().add_callback(start_websocket_connection)
docs: Called when a client opens a websocket connection.
  
          We establish a websocket connection to the proxied backend &
          set up a callback to relay messages through.