You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 12, 2018. It is now read-only.
it seems client can only send message within a callback function like on_open(), because it requires "shared_ptrWssClient::Connection" from the on_open input parameter to make the "connection->send(send_stream);" action. But if in my application, the client side sometimes needs to initiate the message, something like this function:
void sendMsg(msg) {}
can the shared_ptrWssClient::Connection be made into a variable in the client class? or else how to do that? thanks.
The text was updated successfully, but these errors were encountered:
I'm trying the same thing. It seems that once I call client.start(), the thread starts listening to events and I cannot do anything on this thread. I have to start another thread to initiate send from the client (after getting the Connection object).
Is this expected behavior? I'm new to WebSocket, but in traditional socket programming once we connect we can keep operating in the thread.
Yes, this library is asynchronous, so this is expected behaviour. When you call client.start() the handlers (the on_message lambda for instance) are run in this thread.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
it seems client can only send message within a callback function like on_open(), because it requires "shared_ptrWssClient::Connection" from the on_open input parameter to make the "connection->send(send_stream);" action. But if in my application, the client side sometimes needs to initiate the message, something like this function:
void sendMsg(msg) {}
can the shared_ptrWssClient::Connection be made into a variable in the client class? or else how to do that? thanks.
The text was updated successfully, but these errors were encountered: