Skip to content
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

Calling Socket._close() logs an Exception #180

Open
nottirb opened this issue Aug 9, 2024 · 1 comment
Open

Calling Socket._close() logs an Exception #180

nottirb opened this issue Aug 9, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@nottirb
Copy link

nottirb commented Aug 9, 2024

Bug report

Describe the bug

When a websocket is closed using Socket._close(), it logs the following error:

ERROR:root:Connection with the server closed.
Traceback (most recent call last):
  File "realtime/connection.py", line 141, in _keep_alive
    await self.ws_connection.send(json.dumps(data))
  File "python3.11/site-packages/websockets/legacy/protocol.py", line 635, in send
    await self.ensure_open()
  File "python3.11/site-packages/websockets/legacy/protocol.py", line 939, in ensure_open
    raise self.connection_closed_exc()
websockets.exceptions.ConnectionClosedOK: sent 1000 (OK); then received 1000 (OK)

To Reproduce

Setup a Socket connection and then call Socket._close() using the async method.

Expected behavior

When the socket is explicitly closed by calling Socket._close(), I would expect it to:
a) No longer attempt to reconnect
b) Not log an error about the connection being closed

System information

  • Version of realtime-py: 1.0.6
@nottirb nottirb added the bug Something isn't working label Aug 9, 2024
@nottirb nottirb changed the title Calling Socket._close() throws an Exception Calling Socket._close() logs an Exception Aug 9, 2024
@nottirb
Copy link
Author

nottirb commented Aug 9, 2024

If you'd like to maintain this logging pattern, is it possible to move away from using the root logger -- since it directly impacts the root logger of any app someone builds on top of realtime-py?

Specifically, I could resolve this on my end by suppressing error logging from realtime-py, but because you use the root logger I cannot just target realtime-py with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant