Add websocket example that supports permessage-deflate extension
This commit is contained in:
parent
71f4609cb5
commit
145479f095
19 changed files with 2175 additions and 1 deletions
27
examples/websocket_mbedtls/ws.h
Normal file
27
examples/websocket_mbedtls/ws.h
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#ifndef WEBSOCKETS
|
||||
#define WEBSOCKETS
|
||||
|
||||
#include "util.h"
|
||||
|
||||
typedef struct WsFrame_ {
|
||||
Byte finFlag;
|
||||
Byte maskingFlag;
|
||||
Byte opcode;
|
||||
Uint32 payloadLenght;
|
||||
Uint32 maskingMap;
|
||||
Byte *payload;
|
||||
} WsFrame;
|
||||
|
||||
int wsConnect(int socket, const char *host, const char *path, Bool *compression);
|
||||
void wsInitFrame(WsFrame *frame);
|
||||
void wsCreateTextFrame(WsFrame *frame, const char *text);
|
||||
void wsSendFrame(int socket, WsFrame *frame);
|
||||
void wsReceiveFrame(int socket, WsFrame *frame, Bool *timeout, int seconds);
|
||||
void wsInflateFrame(WsFrame *frame);
|
||||
void wsDeflateFrame(WsFrame *frame);
|
||||
void wsSendPong(int socket, WsFrame *frame);
|
||||
void wsSendText(int socket, const char *text, Bool compression);
|
||||
void wsReceiveText(int socket, char *buffer, int bufferSize, Bool compression, Bool *timeout, int seconds);
|
||||
void hex_dump(const char *desc, const void *addr, const size_t len);
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue