Skip to content
Discussion options

You must be logged in to vote

If you want to reproduce the exactly same behavior that you have now with websockets, you would have to call ws_connect for every subscribe and pass user callback to your listener.

class OKXListener(WSListener):
    def __init__(self, user_callback, user_callback_args, user_callback_kwargs):
        self._user_callback = user_callback
        self._user_callback_args = user_callback_args
        self._user_callback_kwargs = user_callback_kwargs

    def on_ws_frame(self, transport, frame: WSFrame):
        # ...

        # Process message
        msg = json.loads(frame.get_payload_as_utf8_text())
        if asyncio.iscoroutinefunction(self._user_callback):
            asyncio.create_task(…

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@tarasko
Comment options

@river-walras
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by tarasko
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #2 on September 14, 2024 22:24.