Poco::Net::WebSocketImpl::_buffer was not used
I wish Poco's websocket implementation takes a buffer to cache the next layer data. If so, I can safely call websocket::receiveFrame() with timeout succussively without corrupting the websocket stream, like this:
Poco::Net::Websocket ws;
ws.setReceiveTimeout(20ms);
std::vector<uint8_t> ws_msg;
while (1) {
// ...
ws.receiveFrame(ws_msg.data(), ws_msg.size());
if (timeout) {
continue;
}
// ...
handleMsg();
}
What's preventing you to do this:
ws.receiveFrame(&ws_msg[0], ws_msg.size());
If a websocket frame is sent by two tcp packet with more than 20ms timeval, then the second call to ws.receiveFrame can not read correct message as the websocket stream is corrupted (just because the library didn't store the previous incomplete bytes). If this is by design, then websocket timeout is an unrecoverable exception.
from what I'm reading, frames are either read completely, or else exception is thrown; but you can express your complaint in code (fix and corresponding test) and send pull request for review
This issue is stale because it has been open for 365 days with no activity.
This issue was closed because it has been inactive for 60 days since being marked as stale.