From 423b0cb462485af351e94757d00050d5e1e133ee Mon Sep 17 00:00:00 2001 From: hiddenalpha.ch Date: Wed, 7 Oct 2026 23:00:34 +0200 Subject: Experiment how to design a websocket --- include/qntan/Qntan.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'include/qntan/Qntan.h') diff --git a/include/qntan/Qntan.h b/include/qntan/Qntan.h index f06a099..759d739 100644 --- a/include/qntan/Qntan.h +++ b/include/qntan/Qntan.h @@ -96,6 +96,7 @@ struct Qntan_JsonDec; struct Qntan_JsonDec_Mentor; struct Qntan_JsonTreeDec_JsonNode; struct Qntan_JsonTreeDec; +struct Qntan_Websocket; struct Qntan_XmlDec; struct Qntan_XmlDec_Mentor; struct Qntan_HttpClient_Exchg_Opts; @@ -1780,6 +1781,34 @@ struct Qntan_JsonTreeDec { +struct Qntan_Websocket { + /* CoDec for + * https://www.rfc-editor.org/info/rfc6455/ + */ + void (*reset)( struct Qntan_Websocket**, + struct Qntan_Socket**socket, void(*socket_unref)(struct Qntan_Socket**), + char const*protoUpgradeRequest, int protoUpgradeRequest_len, + void(*onDone)(int err,Qntan_Cls cls), Qntan_Cls cls ); + /* Initializes this instance to be used on the given `socket`. + * WARN: `socket` then will be kept internally, for further message + * processing. Initially, it points to the 1st byte AFTER the + * initial protocol upgrade request. + * `socket_unref` is an (OPTIONAL) destructor, called as soon the + * library does not need `socket` anymore. + * `protoUpgradeRequest` contains the RAW http-to-websocket protocol + * upgrade request message. + */ +}; + + + + + + + + + + #ifndef Qntan_XmlDec_pause # define Qntan_XmlDec_pause(A) (*A)->pause(A) #endif -- cgit v1.3.1