emscripten-core / emscripten-core/emscripten

[QUESTION] How can I check if my WebSocket client is connected before sending message?

Open
#15,011 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

I've got a server that automatically disconnects WebSocket clients after some time of inactivity. Is there any way I can check if the client is connected and, if not, reconnect before running `emscripten_websocket_send_utf8_text(ws, msg)`? Currently, I get the `WebSocket is already in CLOSING or CLOSED state.` error printed to the console.

Thanks!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.