diff --git a/ixwebsocket/IXWebSocketTransport.cpp b/ixwebsocket/IXWebSocketTransport.cpp index 82bdd0d9..070bd4f6 100644 --- a/ixwebsocket/IXWebSocketTransport.cpp +++ b/ixwebsocket/IXWebSocketTransport.cpp @@ -586,6 +586,12 @@ namespace ix } } + // Make sure we send all the buffered data ; there can be a lot of it + // for large messages. + // TODO / this will block the sending thread ; we need to eval whether + // this is the right fix + while (!isSendBufferEmpty()) sendOnSocket(); + return WebSocketSendInfo(true, compressionError, payloadSize, wireSize); } diff --git a/ws/ws_broadcast_server.cpp b/ws/ws_broadcast_server.cpp index a693967e..3fad7315 100644 --- a/ws/ws_broadcast_server.cpp +++ b/ws/ws_broadcast_server.cpp @@ -64,7 +64,13 @@ namespace ix { if (client != webSocket) { - client->send(str); + client->send(str, + [](int current, int total) -> bool + { + std::cerr << "Step " << current + << " out of " << total << std::endl; + return true; + }); } } } diff --git a/ws/ws_receive.cpp b/ws/ws_receive.cpp index 2e94655e..ee2941e3 100644 --- a/ws/ws_receive.cpp +++ b/ws/ws_receive.cpp @@ -206,6 +206,11 @@ namespace ix handleMessage(str); _condition.notify_one(); } + else if (messageType == ix::WebSocket_MessageType_Fragment) + { + ss << "ws_receive: received fragment"; + log(ss.str()); + } else if (messageType == ix::WebSocket_MessageType_Error) { ss << "Connection error: " << error.reason << std::endl; diff --git a/ws/ws_transfer.cpp b/ws/ws_transfer.cpp index 760e6571..cba06ed8 100644 --- a/ws/ws_transfer.cpp +++ b/ws/ws_transfer.cpp @@ -63,7 +63,13 @@ namespace ix { if (client != webSocket) { - client->send(str); + client->send(str, + [](int current, int total) -> bool + { + std::cerr << "Step " << current + << " out of " << total << std::endl; + return true; + }); } } }