Skip to content
This repository has been archived by the owner on Mar 9, 2022. It is now read-only.

Websockets is under documented, i'm having trouble using it #78

Open
jerrydboonstra opened this issue Jan 3, 2022 · 3 comments
Open

Comments

@jerrydboonstra
Copy link

jerrydboonstra commented Jan 3, 2022

I'm having trouble using the Websockets feature support.

If there were enhanced docs, or a strong example, or test case that would help alot.

  • I cannot figure out how to easily override the various callback methods from their toy versions in the Websocket wrapper object. This is required if we want to do stuff like store message output into databases or queues.
  • managing the thread has been difficult in my configuration (Flask and in GCP Cloud Run remotely) and I'm having trouble with workarounds.

The best progress I made was running the pybit/test.py file which I found browsing the code. This seems like a leftover prototype for the Websockets class that exists, but it gives me some output that works.

Part of the problem could be that I'm running it as part of a Flask application, and managing the background thread is problematic. I'm narrowing in on a solution of running it in Cloud Run as its own application but that requires using some background persistence like Redis: https://cloud.google.com/run/docs/triggering/websockets

Alternatively, I've played with https://kendhia.medium.com/run-python-webserver-flask-as-a-websocket-client-also-175c130f7ca4 to run multiple processes together but it hasn't come together yet.

Any enhanced docs, or a strong example, or test case that would help alot. As I explore this on my own side I will try to contribute back.

@dextertd
Copy link
Collaborator

dextertd commented Jan 4, 2022

Is this regarding websocket on the master branch, or the developing restructure_wss branch?

@jerrydboonstra
Copy link
Author

jerrydboonstra commented Jan 4, 2022

master branch, i wasnt aware of the other branch. i'll look at it.

@jerrydboonstra
Copy link
Author

I took a look and I've been trying to use it. I've created a PR with some enhancements around the tests I made as I explore it.

#81

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants