...
This commit is contained in:
parent
23cf4bd59b
commit
2e5f24f1f8
@ -3,8 +3,11 @@ All notable changes to this project will be documented in this file.
|
||||
|
||||
## [Unreleased] - 2019-06-xx
|
||||
### Changed
|
||||
- IXSocketMbedTLS: better error handling in close and connect
|
||||
- Add explicite WebSocket::sendBinary
|
||||
- New headers + WebSocketMessage class to hold message data, still not used across the board
|
||||
- Add test/compatibility folder with small servers and clients written in different languages and different libraries to test compatibility.
|
||||
- ws echo_server has a -g option to print a greeting message on connect
|
||||
- IXSocketMbedTLS: better error handling in close and connect
|
||||
|
||||
## [3.1.2] - 2019-06-06
|
||||
### Added
|
||||
|
@ -61,6 +61,10 @@ set( IXWEBSOCKET_HEADERS
|
||||
ixwebsocket/IXWebSocketHandshake.h
|
||||
ixwebsocket/IXWebSocketSendInfo.h
|
||||
ixwebsocket/IXWebSocketErrorInfo.h
|
||||
ixwebsocket/IXWebSocketCloseInfo.h
|
||||
ixwebsocket/IXWebSocketOpenInfo.h
|
||||
ixwebsocket/IXWebSocketMessageType.h
|
||||
ixwebsocket/IXWebSocketMessage.h
|
||||
ixwebsocket/IXWebSocketPerMessageDeflate.h
|
||||
ixwebsocket/IXWebSocketPerMessageDeflateCodec.h
|
||||
ixwebsocket/IXWebSocketPerMessageDeflateOptions.h
|
||||
|
@ -380,6 +380,12 @@ namespace ix
|
||||
return sendMessage(data, SendMessageKind::Binary, onProgressCallback);
|
||||
}
|
||||
|
||||
WebSocketSendInfo WebSocket::sendBinary(const std::string& text,
|
||||
const OnProgressCallback& onProgressCallback)
|
||||
{
|
||||
return sendMessage(text, SendMessageKind::Binary, onProgressCallback);
|
||||
}
|
||||
|
||||
WebSocketSendInfo WebSocket::sendText(const std::string& text,
|
||||
const OnProgressCallback& onProgressCallback)
|
||||
{
|
||||
|
@ -69,9 +69,11 @@ namespace ix
|
||||
WebSocketInitResult connect(int timeoutSecs);
|
||||
void run();
|
||||
|
||||
// send binary data
|
||||
// send is in binary mode by default
|
||||
WebSocketSendInfo send(const std::string& data,
|
||||
const OnProgressCallback& onProgressCallback = nullptr);
|
||||
WebSocketSendInfo sendBinary(const std::string& text,
|
||||
const OnProgressCallback& onProgressCallback = nullptr);
|
||||
WebSocketSendInfo sendText(const std::string& text,
|
||||
const OnProgressCallback& onProgressCallback = nullptr);
|
||||
WebSocketSendInfo ping(const std::string& text);
|
||||
|
@ -55,7 +55,7 @@ namespace ix
|
||||
const WebSocketOpenInfo& openInfo,
|
||||
const WebSocketCloseInfo& closeInfo)
|
||||
{
|
||||
MessagePtr message(new Message());
|
||||
auto message = std::make_shared<WebSocketMessage>();
|
||||
|
||||
message->type = type;
|
||||
message->str = str;
|
||||
@ -82,9 +82,9 @@ namespace ix
|
||||
_onMessageUserCallback = std::move(callback);
|
||||
}
|
||||
|
||||
WebSocketMessageQueue::MessagePtr WebSocketMessageQueue::popMessage()
|
||||
WebSocketMessagePtr WebSocketMessageQueue::popMessage()
|
||||
{
|
||||
MessagePtr message;
|
||||
WebSocketMessagePtr message;
|
||||
std::lock_guard<std::mutex> lock(_messagesMutex);
|
||||
|
||||
if (!_messages.empty())
|
||||
@ -101,7 +101,7 @@ namespace ix
|
||||
if (!_onMessageUserCallback)
|
||||
return;
|
||||
|
||||
MessagePtr message;
|
||||
WebSocketMessagePtr message;
|
||||
|
||||
while (count > 0 && (message = popMessage()))
|
||||
{
|
||||
|
@ -20,7 +20,7 @@ namespace
|
||||
{
|
||||
server.setOnConnectionCallback(
|
||||
[&server](std::shared_ptr<ix::WebSocket> webSocket,
|
||||
std::shared_ptr<ConnectionState> connectionState)
|
||||
std::shared_ptr<ConnectionState> connectionState)
|
||||
{
|
||||
webSocket->setOnMessageCallback(
|
||||
[connectionState, &server](ix::WebSocketMessageType messageType,
|
||||
|
@ -172,7 +172,7 @@ namespace ix
|
||||
|
||||
void WebSocketChat::sendMessage(const std::string& text)
|
||||
{
|
||||
_webSocket.send(encodeMessage(text));
|
||||
_webSocket.sendText(encodeMessage(text));
|
||||
}
|
||||
|
||||
int ws_chat_main(const std::string& url,
|
||||
|
@ -138,7 +138,7 @@ namespace ix
|
||||
|
||||
void WebSocketConnect::sendMessage(const std::string& text)
|
||||
{
|
||||
_webSocket.send(text);
|
||||
_webSocket.sendText(text);
|
||||
}
|
||||
|
||||
int ws_connect_main(const std::string& url,
|
||||
|
@ -244,8 +244,8 @@ namespace ix
|
||||
MsgPack msg(pdu);
|
||||
|
||||
Bench bench("Sending file through websocket");
|
||||
_webSocket.send(msg.dump(),
|
||||
[throttle](int current, int total) -> bool
|
||||
_webSocket.sendBinary(msg.dump(),
|
||||
[throttle](int current, int total) -> bool
|
||||
{
|
||||
std::cout << "ws_send: Step " << current << " out of " << total << std::endl;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user