piwebasync/websockets/client.py
def _process_message(self, message: Union[bytes, str]) -> WebsocketMessage:
        """
        Parse message from websocket to WebsocketMessage object

        Args:
            message (Union[str, bytes]): Raw message returned from websocket

        Returns:
            WebsocketMessage: Formatted PI Web API channel message
        """
        
        try:
            content = orjson.loads(message) if isinstance(message, bytes) else json.loads(message)
        except (json.JSONDecodeError, orjson.JSONDecodeError) as err:
            message = message.decode() if isinstance(message, bytes) else message
            content = {
                "Errors": "Unable to parse response content",
                "ResponseContent": message,
                "ErrorMessage": repr(err)
            }    
        return WebsocketMessage(
            url=self.url,
            **content
        )

        Parse message from websocket to WebsocketMessage object

        Args:
            message (Union[str, bytes]): Raw message returned from websocket

        Returns:
            WebsocketMessage: Formatted PI Web API channel message
        
Parse message from websocket to WebsocketMessage object
Parse message from websocket to WebsocketMessage object
def _process_message(self, message: Union[bytes, str]) -> WebsocketMessage:
        try:
            content = orjson.loads(message) if isinstance(message, bytes) else json.loads(message)
        except (json.JSONDecodeError, orjson.JSONDecodeError) as err:
            message = message.decode() if isinstance(message, bytes) else message
            content = {
                "Errors": "Unable to parse response content",
                "ResponseContent": message,
                "ErrorMessage": repr(err)
            }    
        return WebsocketMessage(
            url=self.url,
            **content
        )
def _process_message ( self , message : Union [ bytes , str ] ) -> WebsocketMessage : try : content = orjson . loads ( message ) if isinstance ( message , bytes ) else json . loads ( message ) except ( json . JSONDecodeError , orjson . JSONDecodeError ) as err : message = message . decode ( ) if isinstance ( message , bytes ) else message content = { "Errors" : "Unable to parse response content" , "ResponseContent" : message , "ErrorMessage" : repr ( err ) } return WebsocketMessage ( url = self . url , ** content )
Parse message from websocket to WebsocketMessage object
Parse message from websocket to WebsocketMessage object
"""
        Parse message from websocket to WebsocketMessage object

        Args:
            message (Union[str, bytes]): Raw message returned from websocket

        Returns:
            WebsocketMessage: Formatted PI Web API channel message
        """
Formatted PI Web API channel message
Formatted PI Web API channel message
WebsocketMessage
self
message
Union[bytes, str]
Raw message returned from websocket
Raw message returned from websocket