(ws push_server) on the server side, stop sending and close the connection when the remote end has disconnected

This commit is contained in:
Benjamin Sergeant 2020-08-18 14:09:27 -07:00
parent e8e98e667d
commit fcb92f862d
3 changed files with 12 additions and 2 deletions

View File

@ -2,6 +2,10 @@
All changes to this project will be documented in this file.
## [10.2.7] - 2020-08-18
(ws push_server) on the server side, stop sending and close the connection when the remote end has disconnected
## [10.2.6] - 2020-08-17
(ixwebsocket) replace std::unique_ptr<unsigned char[]> with std::array for some fixed arrays (which are in C++11)

View File

@ -6,4 +6,4 @@
#pragma once
#define IX_WEBSOCKET_VERSION "10.2.6"
#define IX_WEBSOCKET_VERSION "10.2.7"

View File

@ -1692,7 +1692,13 @@ namespace ix
bool binary = false;
while (true)
{
webSocket.send(sendMsg, binary);
auto sendInfo = webSocket.send(sendMsg, binary);
if (!sendInfo.success)
{
spdlog::info("Error sending message, closing connection");
webSocket.close();
break;
}
}
}
else if (msg->type == ix::WebSocketMessageType::Close)