5#ifndef PT_HTTP_WEBSOCKETMESSAGE_H
6#define PT_HTTP_WEBSOCKETMESSAGE_H
8#include <Pt/Http/Api.h>
9#include <Pt/NonCopyable.h>
17class WebSocketConnection;
72 friend class WebSocketConnection;
125 void append(
const char* data, std::size_t n);
129 const char* sendData()
const;
131 std::size_t sendSize()
const;
133 void consume(std::size_t n);
137 PayloadBuffer* _buffer;
Type
Data type of a WebSocket message.
Definition WebSocketMessage.h:78
@ Text
UTF-8 text.
Definition WebSocketMessage.h:80
@ Unknown
No data type yet.
Definition WebSocketMessage.h:79
@ Binary
Binary payload.
Definition WebSocketMessage.h:81
void discard()
Drops the buffered body and leaves the type.
void setType(Type type)
Sets the data type of an outgoing message.
std::iostream & body()
Returns the payload stream.
Definition WebSocketMessage.h:97
std::size_t pending() const
Returns how many payload bytes are waiting to be sent.
void clear()
Drops the buffered body and sets the type to Unknown.
std::size_t available() const
Returns how many payload bytes can be read.
Type type() const
Returns the data type of this message.
Definition WebSocketMessage.h:86
NonCopyable()
Default constructor.
Definition NonCopyable.h:63
HTTP clients and servers.
Core module.
Definition Allocator.h:33