fastdo  0.6.8
eiennet::old_v1::ws 命名空间参考

WebSocket封装 更多...

struct  CloseFramePayloadData
 
struct  FrameBase
 WS帧基类 更多...
 
struct  FrameBasic
 
struct  FrameBasicMasked
 
struct  FrameExtended16
 
struct  FrameExtended16Masked
 
struct  FrameExtended64
 
struct  FrameExtended64Masked
 
struct  WebSocketWrapper
 WebSocket场景包装 更多...
 
class  WsHttpClientCtx
 WsHTTP客户场景 更多...
 
class  WsHttpServer
 WsHTTP服务端 更多...
 

枚举

enum  OpCode : winux::uint {
  dataContinued = 0x0U, dataText = 0x1U, dataBinary = 0x2U, dataRsv3 = 0x3U,
  dataRsv4 = 0x4U, dataRsv5 = 0x5U, dataRsv6 = 0x6U, dataRsv7 = 0x7U,
  ctrlClose = 0x8U, ctrlPing = 0x9U, ctrlPong = 0xAU, ctrlRsvB = 0xBU,
  ctrlRsvC = 0xCU, ctrlRsvD = 0xDU, ctrlRsvE = 0xEU, ctrlRsvF = 0xFU
}
 操作码 更多...
 
enum  WebSocketErrorCode { errNothing, errCnnUnexpectedInvalid }
 WebSocket错误码 更多...
 
enum  FrameType {
  ftBasic = 0b0010, ftBasicMasked = 0b0011, ftExtended16 = 0b0100, ftExtended16Masked = 0b0101,
  ftExtended64 = 0b1000, ftExtended64Masked = 0b1001
}
 数据帧类型 更多...
 
enum  ReadyState { stateConnecting, stateOpen, stateClosing, stateClosed }
 就绪状态 更多...
 

函数

bool SendWebSocketFrame (eiennet::Socket *sock, OpCode opcode, bool fin, bool mask, winux::byte *payloadData=nullptr, size_t payloadDataSize=0)
 
bool SendWebSocketBuffer (eiennet::Socket *sock, OpCode opcode, bool mask, winux::Buffer payloadData=winux::Buffer(), size_t perFrameMaxPayloadSize=-1)
 
bool SendWebSocketAnsi (eiennet::Socket *sock, OpCode opcode, bool mask, winux::AnsiString payloadData=winux::AnsiString(), size_t perFrameMaxPayloadSize=-1)
 

详细描述

WebSocket封装

枚举类型说明

数据帧类型

枚举值
ftBasic 
ftBasicMasked 
ftExtended16 
ftExtended16Masked 
ftExtended64 
ftExtended64Masked 

在文件 eiennet_websocket.hpp90 行定义.

操作码

-> 32 bits 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 -> 4 bytes 0 1 2 3 bit order 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 +-+-+-+-+-——+-+-------——+-------------------------——+ |F|R|R|R| opcode|M| Payload len | Extended payload length | |I|S|S|S| (4) |A| (7) | (16/64) | |N|V|V|V| |S| | (if payload len==126/127) | | |1|2|3| |K| | | +-+-+-+-+-——+-+-------——+ - - - - - - - - - - - - - - - + | Extended payload length continued, if payload len == 127 |

  • - - - - - - - - - - - - - - - +-------------------------——+ | | Masking-key, if MASK set to 1 | +-------------------------——+-------------------------——+ | Masking-key (continued) | Payload data | +--------------------------—— - - - - - - - - - - - - - - - + : Payload data continued ... :
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + | Payload data continued ... | +---------------------------------------------------------——+
枚举值
dataContinued 

continuation frame

dataText 

text frame

dataBinary 

binary frame

dataRsv3 
dataRsv4 
dataRsv5 
dataRsv6 
dataRsv7 
ctrlClose 

close frame

ctrlPing 

ping frame

ctrlPong 

pong frame

ctrlRsvB 
ctrlRsvC 
ctrlRsvD 
ctrlRsvE 
ctrlRsvF 

在文件 eiennet_websocket.hpp61 行定义.

就绪状态

枚举值
stateConnecting 
stateOpen 
stateClosing 
stateClosed 

在文件 eiennet_websocket.hpp101 行定义.

WebSocket错误码

枚举值
errNothing 
errCnnUnexpectedInvalid 

在文件 eiennet_websocket.hpp82 行定义.

函数说明

bool eiennet::old_v1::ws::SendWebSocketAnsi ( eiennet::Socket sock,
OpCode  opcode,
bool  mask,
winux::AnsiString  payloadData = winux::AnsiString(),
size_t  perFrameMaxPayloadSize = -1 
)
bool eiennet::old_v1::ws::SendWebSocketBuffer ( eiennet::Socket sock,
OpCode  opcode,
bool  mask,
winux::Buffer  payloadData = winux::Buffer(),
size_t  perFrameMaxPayloadSize = -1 
)
bool eiennet::old_v1::ws::SendWebSocketFrame ( eiennet::Socket sock,
OpCode  opcode,
bool  fin,
bool  mask,
winux::byte payloadData = nullptr,
size_t  payloadDataSize = 0 
)