41#ifndef _WebSocketServer_h
42#define _WebSocketServer_h
90 struct WSSCB* o,
struct WSS* wss,
void* data,
int len,
int text);
144#define WSSCB_constructor(o, frame, close, ping) \
145 (o)->frameFp=frame,(o)->closeFp=close,(o)->pingFp=ping
201 int write(
const void* data,
int len,
bool isTxt);
211 int close(
int statusCode=1000);
261#define WSS_write(o, data, len, isTxt) WSS_rawWrite(o, data, len, isTxt?1:2)
269#define WSS_isValid(o) SoDispCon_isValid((SoDispCon*)o)
285inline int WSS::write(
const void* data,
int len,
bool isTxt) {
struct WSSCB WSSCB
WebSocket Server Connection Callback Interface: provides an interface between your application and th...
BA_API void WSS_destructor(WSS *o)
Close the transport and free receive storage, without a WebSocket close handshake or close callback.
WSSCB(WSSCB_Frame frameFp, WSSCB_Close closeFp, WSSCB_Ping pingFp=0)
Provide your callback event functions.
Definition: WebSocketServer.h:148
BA_API int WSS_rawWrite(WSS *o, const void *data, int len, int opCode)
Send one final server frame with a caller-selected opcode.
bool isValid()
Check the local transport handle.
Definition: WebSocketServer.h:291
BA_API int WSS_upgrade(WSS *o, HttpRequest *req)
Perform the server handshake and take over the request's connection.
#define WSSCB_constructor(o, frame, close, ping)
Initialize callback storage.
Definition: WebSocketServer.h:144
BA_API void WSS_constructor(WSS *o, WSSCB *cb, SoDisp *disp, int startSize, int expandSize)
Initialize an unconnected WebSocket object.
int close(int statusCode=1000)
Attempt to send a close frame, then close the transport immediately.
Definition: WebSocketServer.h:288
~WSS()
Close the transport and free receive storage, without a WebSocket close handshake or close callback.
Definition: WebSocketServer.h:276
int write(const void *data, int len, bool isTxt)
Send one complete, unmasked server frame using blocking transport writes.
Definition: WebSocketServer.h:285
struct WSS WSS
WebSocket Server (WSS)
BA_API int WSS_connect(WSS *o, HttpConnection *con)
Take an HTTP connection after its WebSocket handshake is complete.
void(* WSSCB_Ping)(struct WSSCB *o, struct WSS *wss, void *data, int len)
Optional notification after the internal pong send attempt succeeds.
Definition: WebSocketServer.h:103
void(* WSSCB_Frame)(struct WSSCB *o, struct WSS *wss, void *data, int len, int text)
Receive a complete unfragmented text or binary frame.
Definition: WebSocketServer.h:89
#define WSS_isValid(o)
Check the local transport handle.
Definition: WebSocketServer.h:269
WSS(WSSCB *cb, SoDisp *disp, int startSize, int expandSize)
Initialize an unconnected WebSocket object.
Definition: WebSocketServer.h:273
void(* WSSCB_Close)(struct WSSCB *o, struct WSS *wss, int status)
Notify closure after the underlying connection has been closed.
Definition: WebSocketServer.h:115
int connect(HttpConnection *con)
Take an HTTP connection after its WebSocket handshake is complete.
Definition: WebSocketServer.h:282
#define WSS_write(o, data, len, isTxt)
Send one complete, unmasked server frame using blocking transport writes.
Definition: WebSocketServer.h:261
BA_API int WSS_close(WSS *o, int statusCode)
Attempt to send a close frame, then close the transport immediately.
int upgrade(HttpRequest *req)
Perform the server handshake and take over the request's connection.
Definition: WebSocketServer.h:279
A dynamic buffer.
Definition: DynBuffer.h:68
Contains information about the physical socket connection.
Definition: HttpConnection.h:80
The HttpServer creates an HttpRequest object when the HttpServer parses a client request.
Definition: HttpServer.h:950
Contains information about the physical socket connection.
Definition: SoDispCon.h:120
The SoDisp dispatches any socket connection that contains data by calling the SoDispCon::execute memb...
Definition: SoDisp.h:91
WebSocket Server Connection Callback Interface: provides an interface between your application and th...
Definition: WebSocketServer.h:123
WebSocket Server (WSS)
Definition: WebSocketServer.h:158