Skip to content

WebSocketClient raw handling should be improved #294

Description

@at-cf

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)

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions