2019-06-09 19:10:33 +02:00
|
|
|
/*
|
|
|
|
* IXWebSocketMessage.h
|
|
|
|
* Author: Benjamin Sergeant
|
|
|
|
* Copyright (c) 2017-2019 Machine Zone, Inc. All rights reserved.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2019-06-09 20:33:17 +02:00
|
|
|
#include "IXWebSocketCloseInfo.h"
|
2019-06-09 19:10:33 +02:00
|
|
|
#include "IXWebSocketErrorInfo.h"
|
2019-06-09 20:33:17 +02:00
|
|
|
#include "IXWebSocketMessageType.h"
|
2019-06-09 19:10:33 +02:00
|
|
|
#include "IXWebSocketOpenInfo.h"
|
|
|
|
#include <memory>
|
2019-06-09 20:33:17 +02:00
|
|
|
#include <string>
|
2019-06-09 19:10:33 +02:00
|
|
|
#include <thread>
|
|
|
|
|
|
|
|
namespace ix
|
|
|
|
{
|
|
|
|
struct WebSocketMessage
|
|
|
|
{
|
|
|
|
WebSocketMessageType type;
|
2020-04-14 06:38:15 +02:00
|
|
|
const std::string& str;
|
2019-06-09 19:10:33 +02:00
|
|
|
size_t wireSize;
|
|
|
|
WebSocketErrorInfo errorInfo;
|
|
|
|
WebSocketOpenInfo openInfo;
|
|
|
|
WebSocketCloseInfo closeInfo;
|
|
|
|
bool binary;
|
2019-06-09 20:33:17 +02:00
|
|
|
|
|
|
|
WebSocketMessage(WebSocketMessageType t,
|
|
|
|
const std::string& s,
|
|
|
|
size_t w,
|
|
|
|
WebSocketErrorInfo e,
|
|
|
|
WebSocketOpenInfo o,
|
2019-06-09 20:55:34 +02:00
|
|
|
WebSocketCloseInfo c,
|
|
|
|
bool b = false)
|
2019-06-09 20:33:17 +02:00
|
|
|
: type(t)
|
2020-04-14 06:38:15 +02:00
|
|
|
, str(s)
|
2019-06-09 20:33:17 +02:00
|
|
|
, wireSize(w)
|
|
|
|
, errorInfo(e)
|
|
|
|
, openInfo(o)
|
|
|
|
, closeInfo(c)
|
2019-06-09 20:55:34 +02:00
|
|
|
, binary(b)
|
2019-06-09 20:33:17 +02:00
|
|
|
{
|
|
|
|
;
|
|
|
|
}
|
2019-06-09 19:10:33 +02:00
|
|
|
};
|
|
|
|
|
2020-04-14 06:56:01 +02:00
|
|
|
using WebSocketMessagePtr = std::unique_ptr<WebSocketMessage>;
|
2019-06-09 19:10:33 +02:00
|
|
|
} // namespace ix
|