Skip to content

webcocket.close() doesn't work #561

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

Closed
ghost opened this issue Jan 23, 2019 · 1 comment
Closed

webcocket.close() doesn't work #561

ghost opened this issue Jan 23, 2019 · 1 comment

Comments

@ghost
Copy link

ghost commented Jan 23, 2019

I am using the websockets library to implement a client that connects to a websocket server running on another websocket implementation (node.js). All is working fine, except that, when I call websocket.close() on the client side nothing happens.

Here is the code:

async def close_w(self):
print("Handling request to close websocket")
if self.is_connected:
print("Websocket is open. Closing.")
self.websocket.close(1000, 'just because')
print("Close request sent. Waiting for actual close.")
r = await self.websocket.wait_closed()
print("Websocket closed")
print("result", r)
print("Close request handled")

The last message I see printed on screen is "Close request sent. Waiting for actual close.", and then it just waits forever

@aaugustin
Copy link
Member

You forgot to await self.websocket.close.

@aaugustin aaugustin mentioned this issue Jun 23, 2019
18 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant