From a6048814484ac5cf8f23a3cc129bba8c3a24ecf0 Mon Sep 17 00:00:00 2001 From: Alex Hultman Date: Sun, 19 Jan 2020 20:24:44 +0100 Subject: [PATCH] Wrap and document unsubscribeAll, ping --- docs/Makefile | 2 +- docs/generated/assets/js/search.js | 2 +- docs/generated/index.html | 22 ++--- docs/generated/interfaces/appoptions.html | 14 ++-- docs/generated/interfaces/httprequest.html | 18 ++--- docs/generated/interfaces/httpresponse.html | 28 +++---- docs/generated/interfaces/templatedapp.html | 32 ++++---- .../interfaces/us_listen_socket.html | 4 +- docs/generated/interfaces/websocket.html | 80 ++++++++++++++++--- .../interfaces/websocketbehavior.html | 20 ++--- docs/index.d.ts | 6 ++ src/WebSocketWrapper.h | 27 ++++++- 12 files changed, 169 insertions(+), 86 deletions(-) diff --git a/docs/Makefile b/docs/Makefile index 1f5ffa3..fc8d90a 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -1,2 +1,2 @@ default: - typedoc --out generated --includeDeclarations --excludeExternals --name "uWebSockets.js v17.0.0 documentation" --mode file --readme none . + typedoc --out generated --includeDeclarations --excludeExternals --name "uWebSockets.js v17.1.0 documentation" --mode file --readme none . diff --git a/docs/generated/assets/js/search.js b/docs/generated/assets/js/search.js index 2a85734..4bea399 100644 --- a/docs/generated/assets/js/search.js +++ b/docs/generated/assets/js/search.js @@ -1,3 +1,3 @@ var typedoc = typedoc || {}; typedoc.search = typedoc.search || {}; - typedoc.search.data = {"kinds":{"32":"Variable","64":"Function","256":"Interface","1024":"Property","2048":"Method","65536":"Type literal","4194304":"Type alias"},"rows":[{"id":0,"kind":256,"name":"us_listen_socket","url":"interfaces/us_listen_socket.html","classes":"tsd-kind-interface"},{"id":1,"kind":256,"name":"WebSocket","url":"interfaces/websocket.html","classes":"tsd-kind-interface"},{"id":2,"kind":2048,"name":"send","url":"interfaces/websocket.html#send","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"WebSocket"},{"id":3,"kind":2048,"name":"getBufferedAmount","url":"interfaces/websocket.html#getbufferedamount","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"WebSocket"},{"id":4,"kind":2048,"name":"end","url":"interfaces/websocket.html#end","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"WebSocket"},{"id":5,"kind":2048,"name":"close","url":"interfaces/websocket.html#close","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"WebSocket"},{"id":6,"kind":2048,"name":"subscribe","url":"interfaces/websocket.html#subscribe","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"WebSocket"},{"id":7,"kind":2048,"name":"unsubscribe","url":"interfaces/websocket.html#unsubscribe","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"WebSocket"},{"id":8,"kind":2048,"name":"publish","url":"interfaces/websocket.html#publish","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"WebSocket"},{"id":9,"kind":2048,"name":"cork","url":"interfaces/websocket.html#cork","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"WebSocket"},{"id":10,"kind":2048,"name":"getRemoteAddress","url":"interfaces/websocket.html#getremoteaddress","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"WebSocket"},{"id":11,"kind":256,"name":"HttpResponse","url":"interfaces/httpresponse.html","classes":"tsd-kind-interface"},{"id":12,"kind":2048,"name":"writeStatus","url":"interfaces/httpresponse.html#writestatus","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"HttpResponse"},{"id":13,"kind":2048,"name":"writeHeader","url":"interfaces/httpresponse.html#writeheader","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"HttpResponse"},{"id":14,"kind":2048,"name":"write","url":"interfaces/httpresponse.html#write","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"HttpResponse"},{"id":15,"kind":2048,"name":"end","url":"interfaces/httpresponse.html#end","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"HttpResponse"},{"id":16,"kind":2048,"name":"tryEnd","url":"interfaces/httpresponse.html#tryend","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"HttpResponse"},{"id":17,"kind":2048,"name":"close","url":"interfaces/httpresponse.html#close","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"HttpResponse"},{"id":18,"kind":2048,"name":"getWriteOffset","url":"interfaces/httpresponse.html#getwriteoffset","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"HttpResponse"},{"id":19,"kind":2048,"name":"onWritable","url":"interfaces/httpresponse.html#onwritable","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"HttpResponse"},{"id":20,"kind":2048,"name":"onAborted","url":"interfaces/httpresponse.html#onaborted","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"HttpResponse"},{"id":21,"kind":2048,"name":"onData","url":"interfaces/httpresponse.html#ondata","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"HttpResponse"},{"id":22,"kind":2048,"name":"getRemoteAddress","url":"interfaces/httpresponse.html#getremoteaddress","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"HttpResponse"},{"id":23,"kind":2048,"name":"cork","url":"interfaces/httpresponse.html#cork","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"HttpResponse"},{"id":24,"kind":256,"name":"HttpRequest","url":"interfaces/httprequest.html","classes":"tsd-kind-interface"},{"id":25,"kind":2048,"name":"getHeader","url":"interfaces/httprequest.html#getheader","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"HttpRequest"},{"id":26,"kind":2048,"name":"getParameter","url":"interfaces/httprequest.html#getparameter","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"HttpRequest"},{"id":27,"kind":2048,"name":"getUrl","url":"interfaces/httprequest.html#geturl","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"HttpRequest"},{"id":28,"kind":2048,"name":"getMethod","url":"interfaces/httprequest.html#getmethod","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"HttpRequest"},{"id":29,"kind":2048,"name":"getQuery","url":"interfaces/httprequest.html#getquery","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"HttpRequest"},{"id":30,"kind":2048,"name":"forEach","url":"interfaces/httprequest.html#foreach","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"HttpRequest"},{"id":31,"kind":2048,"name":"setYield","url":"interfaces/httprequest.html#setyield","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"HttpRequest"},{"id":32,"kind":256,"name":"WebSocketBehavior","url":"interfaces/websocketbehavior.html","classes":"tsd-kind-interface"},{"id":33,"kind":1024,"name":"maxPayloadLength","url":"interfaces/websocketbehavior.html#maxpayloadlength","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"WebSocketBehavior"},{"id":34,"kind":1024,"name":"idleTimeout","url":"interfaces/websocketbehavior.html#idletimeout","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"WebSocketBehavior"},{"id":35,"kind":1024,"name":"compression","url":"interfaces/websocketbehavior.html#compression","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"WebSocketBehavior"},{"id":36,"kind":1024,"name":"maxBackpressure","url":"interfaces/websocketbehavior.html#maxbackpressure","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"WebSocketBehavior"},{"id":37,"kind":1024,"name":"open","url":"interfaces/websocketbehavior.html#open","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"WebSocketBehavior"},{"id":38,"kind":65536,"name":"__type","url":"interfaces/websocketbehavior.html#open.__type-3","classes":"tsd-kind-type-literal tsd-parent-kind-property tsd-is-not-exported","parent":"WebSocketBehavior.open"},{"id":39,"kind":1024,"name":"message","url":"interfaces/websocketbehavior.html#message","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"WebSocketBehavior"},{"id":40,"kind":65536,"name":"__type","url":"interfaces/websocketbehavior.html#message.__type-2","classes":"tsd-kind-type-literal tsd-parent-kind-property tsd-is-not-exported","parent":"WebSocketBehavior.message"},{"id":41,"kind":1024,"name":"drain","url":"interfaces/websocketbehavior.html#drain","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"WebSocketBehavior"},{"id":42,"kind":65536,"name":"__type","url":"interfaces/websocketbehavior.html#drain.__type-1","classes":"tsd-kind-type-literal tsd-parent-kind-property tsd-is-not-exported","parent":"WebSocketBehavior.drain"},{"id":43,"kind":1024,"name":"close","url":"interfaces/websocketbehavior.html#close","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"WebSocketBehavior"},{"id":44,"kind":65536,"name":"__type","url":"interfaces/websocketbehavior.html#close.__type","classes":"tsd-kind-type-literal tsd-parent-kind-property tsd-is-not-exported","parent":"WebSocketBehavior.close"},{"id":45,"kind":256,"name":"AppOptions","url":"interfaces/appoptions.html","classes":"tsd-kind-interface"},{"id":46,"kind":1024,"name":"key_file_name","url":"interfaces/appoptions.html#key_file_name","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"AppOptions"},{"id":47,"kind":1024,"name":"cert_file_name","url":"interfaces/appoptions.html#cert_file_name","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"AppOptions"},{"id":48,"kind":1024,"name":"passphrase","url":"interfaces/appoptions.html#passphrase","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"AppOptions"},{"id":49,"kind":1024,"name":"dh_params_file_name","url":"interfaces/appoptions.html#dh_params_file_name","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"AppOptions"},{"id":50,"kind":1024,"name":"ssl_prefer_low_memory_usage","url":"interfaces/appoptions.html#ssl_prefer_low_memory_usage","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"AppOptions"},{"id":51,"kind":256,"name":"TemplatedApp","url":"interfaces/templatedapp.html","classes":"tsd-kind-interface"},{"id":52,"kind":2048,"name":"listen","url":"interfaces/templatedapp.html#listen","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"TemplatedApp"},{"id":53,"kind":2048,"name":"get","url":"interfaces/templatedapp.html#get","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"TemplatedApp"},{"id":54,"kind":2048,"name":"post","url":"interfaces/templatedapp.html#post","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"TemplatedApp"},{"id":55,"kind":2048,"name":"options","url":"interfaces/templatedapp.html#options","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"TemplatedApp"},{"id":56,"kind":2048,"name":"del","url":"interfaces/templatedapp.html#del","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"TemplatedApp"},{"id":57,"kind":2048,"name":"patch","url":"interfaces/templatedapp.html#patch","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"TemplatedApp"},{"id":58,"kind":2048,"name":"put","url":"interfaces/templatedapp.html#put","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"TemplatedApp"},{"id":59,"kind":2048,"name":"head","url":"interfaces/templatedapp.html#head","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"TemplatedApp"},{"id":60,"kind":2048,"name":"connect","url":"interfaces/templatedapp.html#connect","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"TemplatedApp"},{"id":61,"kind":2048,"name":"trace","url":"interfaces/templatedapp.html#trace","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"TemplatedApp"},{"id":62,"kind":2048,"name":"any","url":"interfaces/templatedapp.html#any","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"TemplatedApp"},{"id":63,"kind":2048,"name":"ws","url":"interfaces/templatedapp.html#ws","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"TemplatedApp"},{"id":64,"kind":2048,"name":"publish","url":"interfaces/templatedapp.html#publish","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"TemplatedApp"},{"id":65,"kind":4194304,"name":"RecognizedString","url":"index.html#recognizedstring","classes":"tsd-kind-type-alias"},{"id":66,"kind":64,"name":"App","url":"index.html#app","classes":"tsd-kind-function"},{"id":67,"kind":64,"name":"SSLApp","url":"index.html#sslapp","classes":"tsd-kind-function"},{"id":68,"kind":64,"name":"us_listen_socket_close","url":"index.html#us_listen_socket_close","classes":"tsd-kind-function"},{"id":69,"kind":4194304,"name":"CompressOptions","url":"index.html#compressoptions","classes":"tsd-kind-type-alias"},{"id":70,"kind":32,"name":"DISABLED","url":"index.html#disabled","classes":"tsd-kind-variable"},{"id":71,"kind":32,"name":"SHARED_COMPRESSOR","url":"index.html#shared_compressor","classes":"tsd-kind-variable"},{"id":72,"kind":32,"name":"DEDICATED_COMPRESSOR","url":"index.html#dedicated_compressor","classes":"tsd-kind-variable"}]}; \ No newline at end of file + typedoc.search.data = {"kinds":{"32":"Variable","64":"Function","256":"Interface","1024":"Property","2048":"Method","65536":"Type literal","4194304":"Type alias"},"rows":[{"id":0,"kind":256,"name":"us_listen_socket","url":"interfaces/us_listen_socket.html","classes":"tsd-kind-interface"},{"id":1,"kind":256,"name":"WebSocket","url":"interfaces/websocket.html","classes":"tsd-kind-interface"},{"id":2,"kind":2048,"name":"send","url":"interfaces/websocket.html#send","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"WebSocket"},{"id":3,"kind":2048,"name":"getBufferedAmount","url":"interfaces/websocket.html#getbufferedamount","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"WebSocket"},{"id":4,"kind":2048,"name":"end","url":"interfaces/websocket.html#end","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"WebSocket"},{"id":5,"kind":2048,"name":"close","url":"interfaces/websocket.html#close","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"WebSocket"},{"id":6,"kind":2048,"name":"ping","url":"interfaces/websocket.html#ping","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"WebSocket"},{"id":7,"kind":2048,"name":"subscribe","url":"interfaces/websocket.html#subscribe","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"WebSocket"},{"id":8,"kind":2048,"name":"unsubscribe","url":"interfaces/websocket.html#unsubscribe","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"WebSocket"},{"id":9,"kind":2048,"name":"unsubscribeAll","url":"interfaces/websocket.html#unsubscribeall","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"WebSocket"},{"id":10,"kind":2048,"name":"publish","url":"interfaces/websocket.html#publish","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"WebSocket"},{"id":11,"kind":2048,"name":"cork","url":"interfaces/websocket.html#cork","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"WebSocket"},{"id":12,"kind":2048,"name":"getRemoteAddress","url":"interfaces/websocket.html#getremoteaddress","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"WebSocket"},{"id":13,"kind":256,"name":"HttpResponse","url":"interfaces/httpresponse.html","classes":"tsd-kind-interface"},{"id":14,"kind":2048,"name":"writeStatus","url":"interfaces/httpresponse.html#writestatus","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"HttpResponse"},{"id":15,"kind":2048,"name":"writeHeader","url":"interfaces/httpresponse.html#writeheader","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"HttpResponse"},{"id":16,"kind":2048,"name":"write","url":"interfaces/httpresponse.html#write","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"HttpResponse"},{"id":17,"kind":2048,"name":"end","url":"interfaces/httpresponse.html#end","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"HttpResponse"},{"id":18,"kind":2048,"name":"tryEnd","url":"interfaces/httpresponse.html#tryend","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"HttpResponse"},{"id":19,"kind":2048,"name":"close","url":"interfaces/httpresponse.html#close","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"HttpResponse"},{"id":20,"kind":2048,"name":"getWriteOffset","url":"interfaces/httpresponse.html#getwriteoffset","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"HttpResponse"},{"id":21,"kind":2048,"name":"onWritable","url":"interfaces/httpresponse.html#onwritable","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"HttpResponse"},{"id":22,"kind":2048,"name":"onAborted","url":"interfaces/httpresponse.html#onaborted","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"HttpResponse"},{"id":23,"kind":2048,"name":"onData","url":"interfaces/httpresponse.html#ondata","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"HttpResponse"},{"id":24,"kind":2048,"name":"getRemoteAddress","url":"interfaces/httpresponse.html#getremoteaddress","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"HttpResponse"},{"id":25,"kind":2048,"name":"cork","url":"interfaces/httpresponse.html#cork","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"HttpResponse"},{"id":26,"kind":256,"name":"HttpRequest","url":"interfaces/httprequest.html","classes":"tsd-kind-interface"},{"id":27,"kind":2048,"name":"getHeader","url":"interfaces/httprequest.html#getheader","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"HttpRequest"},{"id":28,"kind":2048,"name":"getParameter","url":"interfaces/httprequest.html#getparameter","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"HttpRequest"},{"id":29,"kind":2048,"name":"getUrl","url":"interfaces/httprequest.html#geturl","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"HttpRequest"},{"id":30,"kind":2048,"name":"getMethod","url":"interfaces/httprequest.html#getmethod","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"HttpRequest"},{"id":31,"kind":2048,"name":"getQuery","url":"interfaces/httprequest.html#getquery","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"HttpRequest"},{"id":32,"kind":2048,"name":"forEach","url":"interfaces/httprequest.html#foreach","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"HttpRequest"},{"id":33,"kind":2048,"name":"setYield","url":"interfaces/httprequest.html#setyield","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"HttpRequest"},{"id":34,"kind":256,"name":"WebSocketBehavior","url":"interfaces/websocketbehavior.html","classes":"tsd-kind-interface"},{"id":35,"kind":1024,"name":"maxPayloadLength","url":"interfaces/websocketbehavior.html#maxpayloadlength","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"WebSocketBehavior"},{"id":36,"kind":1024,"name":"idleTimeout","url":"interfaces/websocketbehavior.html#idletimeout","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"WebSocketBehavior"},{"id":37,"kind":1024,"name":"compression","url":"interfaces/websocketbehavior.html#compression","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"WebSocketBehavior"},{"id":38,"kind":1024,"name":"maxBackpressure","url":"interfaces/websocketbehavior.html#maxbackpressure","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"WebSocketBehavior"},{"id":39,"kind":1024,"name":"open","url":"interfaces/websocketbehavior.html#open","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"WebSocketBehavior"},{"id":40,"kind":65536,"name":"__type","url":"interfaces/websocketbehavior.html#open.__type-3","classes":"tsd-kind-type-literal tsd-parent-kind-property tsd-is-not-exported","parent":"WebSocketBehavior.open"},{"id":41,"kind":1024,"name":"message","url":"interfaces/websocketbehavior.html#message","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"WebSocketBehavior"},{"id":42,"kind":65536,"name":"__type","url":"interfaces/websocketbehavior.html#message.__type-2","classes":"tsd-kind-type-literal tsd-parent-kind-property tsd-is-not-exported","parent":"WebSocketBehavior.message"},{"id":43,"kind":1024,"name":"drain","url":"interfaces/websocketbehavior.html#drain","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"WebSocketBehavior"},{"id":44,"kind":65536,"name":"__type","url":"interfaces/websocketbehavior.html#drain.__type-1","classes":"tsd-kind-type-literal tsd-parent-kind-property tsd-is-not-exported","parent":"WebSocketBehavior.drain"},{"id":45,"kind":1024,"name":"close","url":"interfaces/websocketbehavior.html#close","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"WebSocketBehavior"},{"id":46,"kind":65536,"name":"__type","url":"interfaces/websocketbehavior.html#close.__type","classes":"tsd-kind-type-literal tsd-parent-kind-property tsd-is-not-exported","parent":"WebSocketBehavior.close"},{"id":47,"kind":256,"name":"AppOptions","url":"interfaces/appoptions.html","classes":"tsd-kind-interface"},{"id":48,"kind":1024,"name":"key_file_name","url":"interfaces/appoptions.html#key_file_name","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"AppOptions"},{"id":49,"kind":1024,"name":"cert_file_name","url":"interfaces/appoptions.html#cert_file_name","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"AppOptions"},{"id":50,"kind":1024,"name":"passphrase","url":"interfaces/appoptions.html#passphrase","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"AppOptions"},{"id":51,"kind":1024,"name":"dh_params_file_name","url":"interfaces/appoptions.html#dh_params_file_name","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"AppOptions"},{"id":52,"kind":1024,"name":"ssl_prefer_low_memory_usage","url":"interfaces/appoptions.html#ssl_prefer_low_memory_usage","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"AppOptions"},{"id":53,"kind":256,"name":"TemplatedApp","url":"interfaces/templatedapp.html","classes":"tsd-kind-interface"},{"id":54,"kind":2048,"name":"listen","url":"interfaces/templatedapp.html#listen","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"TemplatedApp"},{"id":55,"kind":2048,"name":"get","url":"interfaces/templatedapp.html#get","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"TemplatedApp"},{"id":56,"kind":2048,"name":"post","url":"interfaces/templatedapp.html#post","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"TemplatedApp"},{"id":57,"kind":2048,"name":"options","url":"interfaces/templatedapp.html#options","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"TemplatedApp"},{"id":58,"kind":2048,"name":"del","url":"interfaces/templatedapp.html#del","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"TemplatedApp"},{"id":59,"kind":2048,"name":"patch","url":"interfaces/templatedapp.html#patch","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"TemplatedApp"},{"id":60,"kind":2048,"name":"put","url":"interfaces/templatedapp.html#put","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"TemplatedApp"},{"id":61,"kind":2048,"name":"head","url":"interfaces/templatedapp.html#head","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"TemplatedApp"},{"id":62,"kind":2048,"name":"connect","url":"interfaces/templatedapp.html#connect","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"TemplatedApp"},{"id":63,"kind":2048,"name":"trace","url":"interfaces/templatedapp.html#trace","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"TemplatedApp"},{"id":64,"kind":2048,"name":"any","url":"interfaces/templatedapp.html#any","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"TemplatedApp"},{"id":65,"kind":2048,"name":"ws","url":"interfaces/templatedapp.html#ws","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"TemplatedApp"},{"id":66,"kind":2048,"name":"publish","url":"interfaces/templatedapp.html#publish","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"TemplatedApp"},{"id":67,"kind":4194304,"name":"RecognizedString","url":"index.html#recognizedstring","classes":"tsd-kind-type-alias"},{"id":68,"kind":64,"name":"App","url":"index.html#app","classes":"tsd-kind-function"},{"id":69,"kind":64,"name":"SSLApp","url":"index.html#sslapp","classes":"tsd-kind-function"},{"id":70,"kind":64,"name":"us_listen_socket_close","url":"index.html#us_listen_socket_close","classes":"tsd-kind-function"},{"id":71,"kind":4194304,"name":"CompressOptions","url":"index.html#compressoptions","classes":"tsd-kind-type-alias"},{"id":72,"kind":32,"name":"DISABLED","url":"index.html#disabled","classes":"tsd-kind-variable"},{"id":73,"kind":32,"name":"SHARED_COMPRESSOR","url":"index.html#shared_compressor","classes":"tsd-kind-variable"},{"id":74,"kind":32,"name":"DEDICATED_COMPRESSOR","url":"index.html#dedicated_compressor","classes":"tsd-kind-variable"}]}; \ No newline at end of file diff --git a/docs/generated/index.html b/docs/generated/index.html index 4312016..f09dfe1 100644 --- a/docs/generated/index.html +++ b/docs/generated/index.html @@ -3,7 +3,7 @@ - uWebSockets.js v17.0.0 documentation + uWebSockets.js v17.1.0 documentation @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - uWebSockets.js v17.0.0 documentation + uWebSockets.js v17.1.0 documentation
    @@ -54,7 +54,7 @@ Globals -

    uWebSockets.js v17.0.0 documentation

    +

    uWebSockets.js v17.1.0 documentation

    @@ -111,7 +111,7 @@
    CompressOptions: number
    @@ -126,7 +126,7 @@
    RecognizedString: string | ArrayBuffer | Uint8Array | Int8Array | Uint16Array | Int16Array | Uint32Array | Int32Array | Float32Array | Float64Array
    @@ -144,7 +144,7 @@
    DEDICATED_COMPRESSOR: CompressOptions
    @@ -159,7 +159,7 @@
    DISABLED: CompressOptions
    @@ -174,7 +174,7 @@
    SHARED_COMPRESSOR: CompressOptions
    @@ -196,7 +196,7 @@
  • @@ -224,7 +224,7 @@
  • @@ -252,7 +252,7 @@
  • diff --git a/docs/generated/interfaces/appoptions.html b/docs/generated/interfaces/appoptions.html index b174f6e..73897fc 100644 --- a/docs/generated/interfaces/appoptions.html +++ b/docs/generated/interfaces/appoptions.html @@ -3,7 +3,7 @@ - AppOptions | uWebSockets.js v17.0.0 documentation + AppOptions | uWebSockets.js v17.1.0 documentation @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - uWebSockets.js v17.0.0 documentation + uWebSockets.js v17.1.0 documentation
    @@ -104,7 +104,7 @@
    cert_file_name: RecognizedString
    @@ -114,7 +114,7 @@
    dh_params_file_name: RecognizedString
    @@ -124,7 +124,7 @@
    key_file_name: RecognizedString
    @@ -134,7 +134,7 @@
    passphrase: RecognizedString
    @@ -144,7 +144,7 @@
    ssl_prefer_low_memory_usage: boolean
    diff --git a/docs/generated/interfaces/httprequest.html b/docs/generated/interfaces/httprequest.html index ae74f5f..7e6b65a 100644 --- a/docs/generated/interfaces/httprequest.html +++ b/docs/generated/interfaces/httprequest.html @@ -3,7 +3,7 @@ - HttpRequest | uWebSockets.js v17.0.0 documentation + HttpRequest | uWebSockets.js v17.1.0 documentation @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - uWebSockets.js v17.0.0 documentation + uWebSockets.js v17.1.0 documentation
    @@ -110,7 +110,7 @@
  • @@ -159,7 +159,7 @@
  • @@ -187,7 +187,7 @@
  • @@ -209,7 +209,7 @@
  • @@ -237,7 +237,7 @@
  • @@ -259,7 +259,7 @@
  • @@ -281,7 +281,7 @@
  • diff --git a/docs/generated/interfaces/httpresponse.html b/docs/generated/interfaces/httpresponse.html index aebd07c..c07585b 100644 --- a/docs/generated/interfaces/httpresponse.html +++ b/docs/generated/interfaces/httpresponse.html @@ -3,7 +3,7 @@ - HttpResponse | uWebSockets.js v17.0.0 documentation + HttpResponse | uWebSockets.js v17.1.0 documentation @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - uWebSockets.js v17.0.0 documentation + uWebSockets.js v17.1.0 documentation
    @@ -124,7 +124,7 @@
  • @@ -146,7 +146,7 @@
  • @@ -195,7 +195,7 @@
  • @@ -223,7 +223,7 @@
  • @@ -245,7 +245,7 @@
  • @@ -267,7 +267,7 @@
  • @@ -310,7 +310,7 @@
  • @@ -359,7 +359,7 @@
  • @@ -407,7 +407,7 @@
  • @@ -438,7 +438,7 @@
  • @@ -466,7 +466,7 @@
  • @@ -497,7 +497,7 @@
  • diff --git a/docs/generated/interfaces/templatedapp.html b/docs/generated/interfaces/templatedapp.html index 0ad209e..6cc8f48 100644 --- a/docs/generated/interfaces/templatedapp.html +++ b/docs/generated/interfaces/templatedapp.html @@ -3,7 +3,7 @@ - TemplatedApp | uWebSockets.js v17.0.0 documentation + TemplatedApp | uWebSockets.js v17.1.0 documentation @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - uWebSockets.js v17.0.0 documentation + uWebSockets.js v17.1.0 documentation
    @@ -116,7 +116,7 @@
  • @@ -168,7 +168,7 @@
  • @@ -220,7 +220,7 @@
  • @@ -272,7 +272,7 @@
  • @@ -324,7 +324,7 @@
  • @@ -377,7 +377,7 @@
  • @@ -420,7 +420,7 @@
  • @@ -469,7 +469,7 @@
  • @@ -521,7 +521,7 @@
  • @@ -573,7 +573,7 @@
  • @@ -625,7 +625,7 @@
  • @@ -662,7 +662,7 @@
  • @@ -714,7 +714,7 @@
  • @@ -766,7 +766,7 @@
  • diff --git a/docs/generated/interfaces/us_listen_socket.html b/docs/generated/interfaces/us_listen_socket.html index 6c3350d..e914ba4 100644 --- a/docs/generated/interfaces/us_listen_socket.html +++ b/docs/generated/interfaces/us_listen_socket.html @@ -3,7 +3,7 @@ - us_listen_socket | uWebSockets.js v17.0.0 documentation + us_listen_socket | uWebSockets.js v17.1.0 documentation @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - uWebSockets.js v17.0.0 documentation + uWebSockets.js v17.1.0 documentation
    diff --git a/docs/generated/interfaces/websocket.html b/docs/generated/interfaces/websocket.html index 25a7528..f559be4 100644 --- a/docs/generated/interfaces/websocket.html +++ b/docs/generated/interfaces/websocket.html @@ -3,7 +3,7 @@ - WebSocket | uWebSockets.js v17.0.0 documentation + WebSocket | uWebSockets.js v17.1.0 documentation @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - uWebSockets.js v17.0.0 documentation + uWebSockets.js v17.1.0 documentation
    @@ -121,7 +123,7 @@
  • @@ -143,7 +145,7 @@
  • @@ -183,7 +185,7 @@
  • @@ -214,7 +216,7 @@
  • @@ -236,7 +238,7 @@
  • @@ -248,6 +250,34 @@
  • +
    + +

    ping

    + +
      +
    • + +
      +
      +

      Sends a ping control message. Returns true on success, see WebSocket.send. This helper function correlates to WebSocket::send(message, uWS::OpCode::PING, ...).

      +
      +
      +

      Parameters

      + +

      Returns boolean

      +
    • +
    +

    publish

    @@ -258,7 +288,7 @@
  • @@ -295,7 +325,7 @@
  • @@ -329,7 +359,7 @@
  • @@ -357,7 +387,7 @@
  • @@ -375,6 +405,28 @@
  • +
    + +

    unsubscribeAll

    +
      +
    • unsubscribeAll(): void
    • +
    +
      +
    • + +
      +
      +

      Unsubscribe from all topics.

      +
      +
      +

      Returns void

      +
    • +
    +
    @@ -107,7 +107,7 @@
    close: function
    @@ -149,7 +149,7 @@
    compression: CompressOptions
    @@ -164,7 +164,7 @@
    drain: function
    @@ -200,7 +200,7 @@
    idleTimeout: number
    @@ -215,7 +215,7 @@
    maxBackpressure: number
    @@ -230,7 +230,7 @@
    maxPayloadLength: number
    @@ -245,7 +245,7 @@
    message: function
    @@ -287,7 +287,7 @@
    open: function
    diff --git a/docs/index.d.ts b/docs/index.d.ts index a8f08e3..bc575f5 100644 --- a/docs/index.d.ts +++ b/docs/index.d.ts @@ -22,12 +22,18 @@ export interface WebSocket { /** Forcefully closes this WebSocket */ close() : WebSocket; + /** Sends a ping control message. Returns true on success, see WebSocket.send. This helper function correlates to WebSocket::send(message, uWS::OpCode::PING, ...). */ + ping(message?: RecognizedString) : boolean; + /** Subscribe to a topic in MQTT syntax */ subscribe(topic: RecognizedString) : WebSocket; /** Unsubscribe from a topic. Returns true on success, if the WebSocket was subscribed. */ unsubscribe(topic: RecognizedString) : boolean; + /** Unsubscribe from all topics. */ + unsubscribeAll() : void; + /** Publish a message to a topic in MQTT syntax */ publish(topic: RecognizedString, message: RecognizedString, isBinary?: boolean, compress?: boolean) : WebSocket; diff --git a/src/WebSocketWrapper.h b/src/WebSocketWrapper.h index 6035826..d3e8b58 100644 --- a/src/WebSocketWrapper.h +++ b/src/WebSocketWrapper.h @@ -121,7 +121,7 @@ struct WebSocketWrapper { } } - /* Takes message, isBinary. Returns true on success, false otherwise */ + /* Takes message, isBinary, compressed. Returns true on success, false otherwise */ template static void uWS_WebSocket_send(const FunctionCallbackInfo &args) { Isolate *isolate = args.GetIsolate(); @@ -138,8 +138,26 @@ struct WebSocketWrapper { } } + /* Takes message. Returns true on success, false otherwise */ + template + static void uWS_WebSocket_ping(const FunctionCallbackInfo &args) { + Isolate *isolate = args.GetIsolate(); + auto *ws = getWebSocket(args); + if (ws) { + NativeString message(args.GetIsolate(), args[0]); + if (message.isInvalid(args)) { + return; + } + + /* This is a wrapper that does not exist in the C++ project */ + bool ok = ws->send(message.getString(), uWS::OpCode::PING); + + args.GetReturnValue().Set(Boolean::New(isolate, ok)); + } + } + /* Takes nothing, returns this */ - /*template + template static void uWS_WebSocket_unsubscribeAll(const FunctionCallbackInfo &args) { Isolate *isolate = args.GetIsolate(); auto *ws = getWebSocket(args); @@ -147,7 +165,7 @@ struct WebSocketWrapper { ws->unsubscribeAll(); args.GetReturnValue().Set(args.Holder()); } - }*/ + } /* Takes function, returns this */ template @@ -184,8 +202,9 @@ struct WebSocketWrapper { wsTemplateLocal->PrototypeTemplate()->Set(String::NewFromUtf8(isolate, "subscribe", NewStringType::kNormal).ToLocalChecked(), FunctionTemplate::New(isolate, uWS_WebSocket_subscribe)); wsTemplateLocal->PrototypeTemplate()->Set(String::NewFromUtf8(isolate, "unsubscribe", NewStringType::kNormal).ToLocalChecked(), FunctionTemplate::New(isolate, uWS_WebSocket_unsubscribe)); wsTemplateLocal->PrototypeTemplate()->Set(String::NewFromUtf8(isolate, "publish", NewStringType::kNormal).ToLocalChecked(), FunctionTemplate::New(isolate, uWS_WebSocket_publish)); - //wsTemplateLocal->PrototypeTemplate()->Set(String::NewFromUtf8(isolate, "unsubscribeAll", NewStringType::kNormal).ToLocalChecked(), FunctionTemplate::New(isolate, uWS_WebSocket_unsubscribeAll)); + wsTemplateLocal->PrototypeTemplate()->Set(String::NewFromUtf8(isolate, "unsubscribeAll", NewStringType::kNormal).ToLocalChecked(), FunctionTemplate::New(isolate, uWS_WebSocket_unsubscribeAll)); wsTemplateLocal->PrototypeTemplate()->Set(String::NewFromUtf8(isolate, "cork", NewStringType::kNormal).ToLocalChecked(), FunctionTemplate::New(isolate, uWS_WebSocket_cork)); + wsTemplateLocal->PrototypeTemplate()->Set(String::NewFromUtf8(isolate, "ping", NewStringType::kNormal).ToLocalChecked(), FunctionTemplate::New(isolate, uWS_WebSocket_ping)); /* Create the template */ Local wsObjectLocal = wsTemplateLocal->GetFunction(isolate->GetCurrentContext()).ToLocalChecked()->NewInstance(isolate->GetCurrentContext()).ToLocalChecked();