Closed mickae1 closed 5 years ago
Hello,
You don't have to use ulfius_websocket_wait_close
if you don't want to. This function is part of the Websocket status functions explained in the documentation.
The function ulfius_websocket_wait_close
returns the value U_WEBSOCKET_STATUS_OPEN
if the websocket is still open at the end of the specified timeout and U_WEBSOCKET_STATUS_CLOSE
is the websocket is closed.
If you want to get the websocket status without timeout, you can simply use ulfius_websocket_status
, this will return the same values than ulfius_websocket_wait_close
. The intention of these functions is to avoid sending messages on a websocket that has been closed by the client or by the network.
In the websocket example program, the server is intended to send a message every 2 seconds.
But you can definitely use another method to manage your messages sent to the websocket, that's up to your implementation.
@mickae1 , does this answer your question?
Yes thanks.
Le lun. 23 sept. 2019 à 18:59, Nicolas Mora notifications@github.com a écrit :
@mickae1 https://github.com/mickae1 , does this answer your question?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/babelouest/ulfius/issues/139?email_source=notifications&email_token=ABAHMCHHFXXICILOPZNTVZ3QLDYW5A5CNFSM4IX4DLL2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7LRMUI#issuecomment-534189649, or mute the thread https://github.com/notifications/unsubscribe-auth/ABAHMCGT5ZOVXJZ6JEPHOADQLDYW5ANCNFSM4IX4DLLQ .
Ok, I'm closing the issue then.
Hi,
When I want to send data over websocket in a while loop, I've to do something like that:
Why do I need to use the function ulfius_websocket_wait_close ..... And sometime if the timeout is too short, i've to repeat the procedure to make it work.
I don't like to use ulfius_websocket_wait_close , because if you put a 2s timeout, it will wait 2s.
ulfius 2.6.3