INNER CODE UNIT · Python

send_message

dusty-nv/jetson-containers · packages/llm/local_llm/web/server.py:168

    def send_message(self, payload, type=None, timestamp=None):
        """
        Send a websocket message to client
        """
        if timestamp is None:
            timestamp = time.time() * 1000
         
        encoding = None
        
        if type is None:
            if isinstance(payload, str):
                type = WebServer.MESSAGE_TEXT
                encoding = 'utf-8'
            elif isinstance(payload, bytes):
                type = WebServer.MESSAGE_BINARY
            else:
                type = WebServer.MESSAGE_JSON
                encoding = 'ascii'

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…