-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How do I close a client.ws conection? #63
Comments
A close websocket function was added in this PR #63. Please see this example on how to use:
|
Hi, this function works on specific event like 'order_book_snapshot', but how to close connection from the main thread on demand?
`--------------------------------------------------------------------------- ~/anaconda3/envs/arb/lib/python3.8/site-packages/bfxapi/websockets/generic_websocket.py in stop(self) ~/anaconda3/envs/arb/lib/python3.8/site-packages/websockets/protocol.py in close(self, code, reason) ~/anaconda3/envs/arb/lib/python3.8/asyncio/tasks.py in wait_for(fut, timeout, loop) RuntimeError: Task <Task pending name='Task-5' coro=<InteractiveShell.run_cell_async() running at /home/dima/anaconda3/envs/arb/lib/python3.8/site-packages/IPython/core/interactiveshell.py:3155> cb=[IPythonKernel._cancel_on_sigint..cancel_unless_done(<Future pendi...ernel.py:230]>)() at /home/dima/anaconda3/envs/arb/lib/python3.8/site-packages/ipykernel/ipkernel.py:230, IOLoop.add_future..() at /home/dima/anaconda3/envs/arb/lib/python3.8/site-packages/tornado/ioloop.py:688]> got Future attached to a different loop` |
I don't know how to close my websocket connection, so in case of an exception the program shuts down for being able to run again.
Here is a simplified version of code
I just want to open the connection, wait a few seconds and then close it
Can somebody tell me how to do this? I'm new to programming and have tried lots of stuff unsuccessfully
The text was updated successfully, but these errors were encountered: