A client will use raw=True for performance purposes. WebSocketClient ignores this and parses messages using the inefficient json module purely for internal debugging purposes, while passing the unparsed message to the handler, which will need to be parsed again. This means that raw=True is actually slower.
It should be like this to avoid pointles parsing:
if not self.raw:
# we know cmsg is Data
msgJson = self.json.loads(cmsg) # type: ignore
for m in msgJson:
if m["ev"] == "status":
logger.debug("status: %s", m["message"])
continue
cmsg = parse(msgJson, logger)
A client will use raw=True for performance purposes. WebSocketClient ignores this and parses messages using the inefficient json module purely for internal debugging purposes, while passing the unparsed message to the handler, which will need to be parsed again. This means that raw=True is actually slower.
It should be like this to avoid pointles parsing: