MCPcopy Create free account
hub / github.com/axmolengine/axmol / closeAsync

Method closeAsync

core/network/WebSocket.cpp:493–505  ·  view source on GitHub ↗

* @brief Closes the connection to server asynchronously. * @note It's an asynchronous method, it just notifies websocket thread to exit and returns directly, * If using 'closeAsync' to close websocket connection, * be careful of not using destructed variables in the callback of 'onClose'. */

Source from the content-addressed store, hash-verified

491 * be careful of not using destructed variables in the callback of 'onClose'.
492 */
493void WebSocket::closeAsync(uint16_t code, std::string_view reason)
494{
495 if (_state < State::CLOSING)
496 {
497 if (_service->is_open(0))
498 {
499 _state = State::CLOSING;
500 _service->close(0);
501 }
502 else
503 _state = State::CLOSED;
504 }
505}
506
507void WebSocket::generateHandshakeSecKey()
508{

Callers 2

onExitMethod · 0.45
axlua_WebSocket_close00Function · 0.45

Calls 2

is_openMethod · 0.45
closeMethod · 0.45

Tested by 1

onExitMethod · 0.36