WebSocket::send takes a third arg, binary which default to true (can be text too)

This commit is contained in:
Benjamin Sergeant
2019-06-09 11:35:31 -07:00
parent be93f7480a
commit 0d147cbd94
3 changed files with 8 additions and 3 deletions

View File

@ -385,9 +385,12 @@ namespace ix
}
WebSocketSendInfo WebSocket::send(const std::string& data,
const OnProgressCallback& onProgressCallback)
const OnProgressCallback& onProgressCallback,
bool binary)
{
return sendMessage(data, SendMessageKind::Binary, onProgressCallback);
return sendMessage(data,
(binary) ? SendMessageKind::Binary: SendMessageKind::Text,
onProgressCallback);
}
WebSocketSendInfo WebSocket::sendBinary(const std::string& text,

View File

@ -66,7 +66,8 @@ namespace ix
// send is in binary mode by default
WebSocketSendInfo send(const std::string& data,
const OnProgressCallback& onProgressCallback = nullptr);
const OnProgressCallback& onProgressCallback = nullptr,
bool binary = true);
WebSocketSendInfo sendBinary(const std::string& text,
const OnProgressCallback& onProgressCallback = nullptr);
WebSocketSendInfo sendText(const std::string& text,