diff options
| author | Per Larsson <[email protected]> | 2022-03-11 15:45:04 +0100 |
|---|---|---|
| committer | Per Larsson <[email protected]> | 2022-03-11 15:45:04 +0100 |
| commit | 9a29f19672d75e56f012baeaf9f7f91c15ac7479 (patch) | |
| tree | 49ef61a880336fc573031f34d76465801a1c92c0 /zenhttp/websocketasio.cpp | |
| parent | Added streaming version of GetCacheChunks. (diff) | |
| download | zen-9a29f19672d75e56f012baeaf9f7f91c15ac7479.tar.xz zen-9a29f19672d75e56f012baeaf9f7f91c15ac7479.zip | |
Combine last stream response with stream complete message.
Diffstat (limited to 'zenhttp/websocketasio.cpp')
| -rw-r--r-- | zenhttp/websocketasio.cpp | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/zenhttp/websocketasio.cpp b/zenhttp/websocketasio.cpp index 9b64cc0a5..bbe7e1ad8 100644 --- a/zenhttp/websocketasio.cpp +++ b/zenhttp/websocketasio.cpp @@ -1577,11 +1577,11 @@ WebSocketService::Configure(WebSocketServer& Server) } void -WebSocketService::SendStreamResponse(WebSocketId SocketId, uint32_t CorrelationId, CbPackage&& StreamResponse) +WebSocketService::SendStreamResponse(WebSocketId SocketId, uint32_t CorrelationId, CbPackage&& StreamResponse, bool IsStreamComplete) { WebSocketMessage Message; - Message.SetMessageType(WebSocketMessageType::kStreamResponse); + Message.SetMessageType(IsStreamComplete ? WebSocketMessageType::kStreamCompleteResponse : WebSocketMessageType::kStreamResponse); Message.SetCorrelationId(CorrelationId); Message.SetSocketId(SocketId); Message.SetBody(std::move(StreamResponse)); @@ -1590,24 +1590,12 @@ WebSocketService::SendStreamResponse(WebSocketId SocketId, uint32_t CorrelationI } void -WebSocketService::SendStreamResponse(WebSocketId SocketId, uint32_t CorrelationId, CbObject&& StreamResponse) +WebSocketService::SendStreamResponse(WebSocketId SocketId, uint32_t CorrelationId, CbObject&& StreamResponse, bool IsStreamComplete) { CbPackage Response; Response.SetObject(std::move(StreamResponse)); - SendStreamResponse(SocketId, CorrelationId, std::move(Response)); -} - -void -WebSocketService::SendStreamCompleteResponse(WebSocketId SocketId, uint32_t CorrelationId) -{ - WebSocketMessage Message; - - Message.SetMessageType(WebSocketMessageType::kStreamCompleteResponse); - Message.SetCorrelationId(CorrelationId); - Message.SetSocketId(SocketId); - - SocketServer().SendResponse(std::move(Message)); + SendStreamResponse(SocketId, CorrelationId, std::move(Response), IsStreamComplete); } std::unique_ptr<WebSocketServer> |