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

Exception when client disconnects from server #92

Open
stas-andr opened this issue Jan 15, 2024 · 0 comments
Open

Exception when client disconnects from server #92

stas-andr opened this issue Jan 15, 2024 · 0 comments

Comments

@stas-andr
Copy link

Hello, I use WebsocketServer from ypy-websockets:

    while True:
        try:
            async with (
                WebsocketServer(log=logger) as websocket_server,
                serve(
                    my_ws_handler(websocket_server),
                    GeneralConfig.WS_SERVER_HOST,
                    5567,
                    ping_interval=None,
                ),
            ):
                await asyncio.Future()
        except Exception as exp:
            global PREV_COUNT_CLIENTS_WS
            print(websocket_server.rooms)
            PREV_COUNT_CLIENTS_WS = 0
            logger.error(str(exp))
            logger.info('Restart server')

When my client disconnects, the server crashes due to the below fault. I had to restart the server, what are the alternatives?
Error:
| websockets.exceptions.ConnectionClosedOK: received 1000 (OK); then sent 1000 (OK)

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