Skip to content

Implementing own Dispatcher #989

@soerenbe

Description

@soerenbe

Hi there,
I currently tried to implement my own dispatcher to implement a exponential backoff timeout to increase the timeout after several retries. After digging into the code some of the parts felt a little off. Maybe I did not understand the concept of the dispatcher completely, but on the other hand this part was not documented very well.

I implemented my ExponentialBackoffTimeoutDispatcher(WebsocketDispatcher). After some testing I found that the dispatcher is wrapped by the WrappedDispatcher. I think I did not understand why this is required. I ran into following troubles:

  1. The WrappedDispatcher calls .read without the check_callback parameter. (https://github.com/websocket-client/websocket-client/blob/master/websocket/_app.py#L149)
  2. The WrappedDispatcher expects the methods .signal and .abort to be implemented. I have no clue why. (https://github.com/websocket-client/websocket-client/blob/master/websocket/_app.py#L141)

I have the feeling that implementing a own dispatcher is not very common an this code part got lost in the last years. It could also be possible that I am completely on the wrong path. I have my solution, but it feels kinda wrong.

Either way, this is maybe a bug, missing documentation or a stupid user. You may choose. :-)

Best Regards
Sören

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions