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 de0bf5ebcd
commit a11aa3e0dd
3 changed files with 8 additions and 3 deletions

View File

@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file.
## [Unreleased] - 2019-06-xx
### Changed
- WebSocket::send takes a third arg, binary which default to true (can be text too)
- WebSocket callback only take one object, a const ix::WebSocketMessagePtr& msg
- Add explicite WebSocket::sendBinary
- New headers + WebSocketMessage class to hold message data, still not used across the board

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,