Introduction of IXWebSocketSendData (#347)
* Introduction of IXWebSocketSendData that makes it possible to not only send std::string but also std::vector<char/uint8_t> and char* without copying them to a std::string first. Add a sendUtf8Text() method that doesn't check for invalid UTF-8 characters. The caller must guarantee that the string only contains valid UTF-8 characters. * Updated usage.md: sendUtf8Text() and IXWebSocketSendData
This commit is contained in:
committed by
GitHub
parent
2bc3afcf6c
commit
b5cf33a582
@ -17,6 +17,7 @@
|
||||
#include "IXWebSocketMessage.h"
|
||||
#include "IXWebSocketPerMessageDeflateOptions.h"
|
||||
#include "IXWebSocketSendInfo.h"
|
||||
#include "IXWebSocketSendData.h"
|
||||
#include "IXWebSocketTransport.h"
|
||||
#include <atomic>
|
||||
#include <condition_variable>
|
||||
@ -75,8 +76,16 @@ namespace ix
|
||||
WebSocketSendInfo send(const std::string& data,
|
||||
bool binary = false,
|
||||
const OnProgressCallback& onProgressCallback = nullptr);
|
||||
WebSocketSendInfo sendBinary(const std::string& text,
|
||||
WebSocketSendInfo sendBinary(const std::string& data,
|
||||
const OnProgressCallback& onProgressCallback = nullptr);
|
||||
WebSocketSendInfo sendBinary(const IXWebSocketSendData& data,
|
||||
const OnProgressCallback& onProgressCallback = nullptr);
|
||||
// does not check for valid UTF-8 characters. Caller must check that.
|
||||
WebSocketSendInfo sendUtf8Text(const std::string& text,
|
||||
const OnProgressCallback& onProgressCallback = nullptr);
|
||||
// does not check for valid UTF-8 characters. Caller must check that.
|
||||
WebSocketSendInfo sendUtf8Text(const IXWebSocketSendData& text,
|
||||
const OnProgressCallback& onProgressCallback = nullptr);
|
||||
WebSocketSendInfo sendText(const std::string& text,
|
||||
const OnProgressCallback& onProgressCallback = nullptr);
|
||||
WebSocketSendInfo ping(const std::string& text);
|
||||
@ -107,7 +116,7 @@ namespace ix
|
||||
const std::vector<std::string>& getSubProtocols();
|
||||
|
||||
private:
|
||||
WebSocketSendInfo sendMessage(const std::string& text,
|
||||
WebSocketSendInfo sendMessage(const IXWebSocketSendData& message,
|
||||
SendMessageKind sendMessageKind,
|
||||
const OnProgressCallback& callback = nullptr);
|
||||
|
||||
|
Reference in New Issue
Block a user