Project homepage Mailing List  Warmcat.com  API Docs  Github Mirror 
{"schema":"libjg2-1", "vpath":"/git/", "avatar":"/git/avatar/", "alang":"", "gen_ut":1713601780, "reponame":"libwebsockets", "desc":"libwebsockets lightweight C networking library", "owner": { "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" },"url":"https://libwebsockets.org/repo/libwebsockets", "f":3, "items": [ {"schema":"libjg2-1", "cid":"d0aef31198a7bdf1ad3cffdb0aa7233f", "commit": {"type":"commit", "time": 1514939429, "time_ofs": 480, "oid_tree": { "oid": "8fa2f0ce6914ce5556f095fb36f8d45832f14c0b", "alias": []}, "oid":{ "oid": "13a7a8d0a2f673d23a643347d7ec8181d0eb65cb", "alias": []}, "msg": "docs: spell out how to set the default protocol when client doesnt give any", "sig_commit": { "git_time": { "time": 1514939429, "offset": 480 }, "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" }, "sig_author": { "git_time": { "time": 1514939429, "offset": 480 }, "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" }}, "body": "docs: spell out how to set the default protocol when client doesnt give any\n" , "diff": "diff --git a/READMEs/README.coding.md b/READMEs/README.coding.md\nindex 18bdaf8..93e8d40 100644\n--- a/READMEs/README.coding.md\n+++ b/READMEs/README.coding.md\n@@ -161,6 +161,47 @@ you might simultaneously create more than one context from different threads.\n SSL_library_init() is called from the context create api and it also is not\n reentrant. So at least create the contexts sequentially.\n \n+@section anonprot Working without a protocol name\n+\n+Websockets allows connections to negotiate without a protocol name...\n+in that case by default it will bind to the first protocol in your\n+vhost protocols[] array.\n+\n+You can tell the vhost to use a different protocol by attaching a\n+pvo (per-vhost option) to the \n+\n+```\n+/*\n+ * this sets a per-vhost, per-protocol option name:value pair\n+ * the effect is to set this protocol to be the default one for the vhost,\n+ * ie, selected if no Protocol: header is sent with the ws upgrade.\n+ */\n+\n+static const struct lws_protocol_vhost_options pvo_opt \u003d {\n+\tNULL,\n+\tNULL,\n+\t\u0022default\u0022,\n+\t\u00221\u0022\n+};\n+\n+static const struct lws_protocol_vhost_options pvo \u003d {\n+\tNULL,\n+\t\u0026pvo_opt,\n+\t\u0022my-protocol\u0022,\n+\t\u0022\u0022\n+};\n+\n+...\n+\n+\tcontext_info.pvo \u003d \u0026pvo;\n+...\n+\n+```\n+\n+Will select \u0022my-protocol\u0022 from your protocol list (even if it came\n+in by plugin) as being the target of client connections that don't\n+specify a protocol.\n+\n @section closing Closing connections from the user side\n \n When you want to close a connection, you do it by returning `-1` from a\n","s":{"c":1713601780,"u": 1617}} ],"g": 8323,"chitpc": 0,"ehitpc": 0,"indexed":0 , "ab": 0, "si": 0, "db":0, "di":0, "sat":0, "lfc": "0000"}