Project homepage Mailing List  Warmcat.com  API Docs  Github Mirror 
{"schema":"libjg2-1", "vpath":"/git/", "avatar":"/git/avatar/", "alang":"", "gen_ut":1752654970, "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":"98ca74c0b4298259d4717fc6cce37211", "commit": {"type":"commit", "time": 1468457848, "time_ofs": 480, "oid_tree": { "oid": "ac048794680a29a8948ec1b0085278ed6c5390c6", "alias": []}, "oid":{ "oid": "2671b7469a15e6853193dac54c125b15ca6f23ef", "alias": []}, "msg": "plugins-dim-webpage-when-connection-lost", "sig_commit": { "git_time": { "time": 1468457848, "offset": 480 }, "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" }, "sig_author": { "git_time": { "time": 1468370722, "offset": 480 }, "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" }}, "body": "plugins-dim-webpage-when-connection-lost" , "diff": "diff --git a/README.coding.md b/README.coding.md\nindex 7a85e33..b4fc811 100644\n--- a/README.coding.md\n+++ b/README.coding.md\n@@ -672,3 +672,25 @@ the protocol struct.\n This allocation is only deleted / replaced when the connection accesses a\n URL region with a different protocol (or the default protocols[0] if no\n CALLBACK area matches it).\n+\n+@section dim Dimming webpage when connection lost\n+\n+The lws test plugins' html provides useful feedback on the webpage about if it\n+is still connected to the server, by greying out the page if not. You can\n+also add this to your own html easily\n+\n+ - include lws-common.js from your HEAD section\n+ \n+ \u003cscript src\u003d\u0022/lws-common.js\u0022\u003e\u003c/script\u003e\n+ \n+ - dim the page during initialization, in a script section on your page\n+ \n+ lws_gray_out(true,{'zindex':'499'});\n+ \n+ - in your ws onOpen(), remove the dimming\n+ \n+ lws_gray_out(false);\n+ \n+ - in your ws onClose(), reapply the dimming\n+ \n+ lws_gray_out(true,{'zindex':'499'});\ndiff --git a/plugins/generic-sessions/assets/index.html b/plugins/generic-sessions/assets/index.html\nindex d370f9d..f0703c0 100644\n--- a/plugins/generic-sessions/assets/index.html\n+++ b/plugins/generic-sessions/assets/index.html\n@@ -1,5 +1,6 @@\n \u003chtml\u003e\n \u003chead\u003e\n+ \u003cscript src\u003d\u0022/lws-common.js\u0022\u003e\u003c/script\u003e\n \u003cscript src\u003d\u0022lwsgs.js\u0022\u003e\u003c/script\u003e\n \u003cstyle\u003e\n \t.body { font-size: 12 }\n@@ -21,7 +22,7 @@\n \u003cimg src\u003d\u0022lwsgs-logo.png\u0022\u003e\n \u003c/td\u003e\n \u003ctd style\u003d\u0022vertical-align:top;float:right\u0022\u003e\n-\t\u003cdiv id\u003dlwsgs style\u003d\u0022text-align:right;background-color: rgba(255, 255, 255, 0.8);\u0022\u003e\u003c/div\u003e\n+\t\u003cdiv id\u003dlwsgs style\u003d\u0022zIndex: 1000;text-align:right;background-color: rgba(255, 255, 255, 0.8);\u0022\u003e\u003c/div\u003e\n \u003c/td\u003e\n \u003c/tr\u003e\n \ndiff --git a/plugins/server-status.html b/plugins/server-status.html\nindex 5a299c8..155287d 100644\n--- a/plugins/server-status.html\n+++ b/plugins/server-status.html\n@@ -2,6 +2,7 @@\n \u003chtml lang\u003d\u0022en\u0022\u003e\n \u003chead\u003e\n \u003cmeta charset\u003dutf-8 http-equiv\u003d\u0022Content-Language\u0022 content\u003d\u0022en\u0022/\u003e\n+ \u003cscript src\u003d\u0022/lws-common.js\u0022\u003e\u003c/script\u003e\n \u003ctitle\u003eLWS Server Status\u003c/title\u003e\n \u003cstyle type\u003d\u0022text/css\u0022\u003e\n \tspan.title { font-size:18pt; font: Arial; font-weight:normal;\n@@ -121,6 +122,8 @@\n \n \u003cscript\u003e\n \n+lws_gray_out(true,{'zindex':'499'});\n+\n /*\n * We display untrusted stuff in html context... reject anything\n * that has HTML stuff in it\n@@ -193,6 +196,7 @@ function get_appropriate_ws_url()\n \ttry {\n \t\tsocket_status.onopen \u003d function() {\n \t\t\tdocument.getElementById(\u0022title\u0022).innerHTML \u003d \u0022Server Status (Active)\u0022;\n+\t\t\tlws_gray_out(false);\n \t\t}\n \n \t\tsocket_status.onmessage \u003dfunction got_packet(msg) {\n@@ -286,6 +290,7 @@ function get_appropriate_ws_url()\n \n \t\tsocket_status.onclose \u003d function(){\n \t\t\tdocument.getElementById(\u0022title\u0022).innerHTML \u003d \u0022Server Status (Disconnected)\u0022;\n+\t\t\tlws_gray_out(true,{'zindex':'499'});\n \t\t}\n \t} catch(exception) {\n \t\talert('\u003cp\u003eError' + exception); \ndiff --git a/test-server/test-server-http.c b/test-server/test-server-http.c\nindex cdd136d..e15cef9 100644\n--- a/test-server/test-server-http.c\n+++ b/test-server/test-server-http.c\n@@ -118,6 +118,9 @@ const char * get_mimetype(const char *file)\n \tif (!strcmp(\u0026file[n - 4], \u0022.css\u0022))\n \t\treturn \u0022text/css\u0022;\n \n+\tif (!strcmp(\u0026file[n - 3], \u0022.js\u0022))\n+\t\treturn \u0022text/javascript\u0022;\n+\n \treturn NULL;\n }\n \ndiff --git a/test-server/test.html b/test-server/test.html\nindex c7ae069..3c5a482 100644\n--- a/test-server/test.html\n+++ b/test-server/test.html\n@@ -2,6 +2,7 @@\n \u003chtml lang\u003d\u0022en\u0022\u003e\n \u003chead\u003e\n \u003cmeta charset\u003dutf-8 http-equiv\u003d\u0022Content-Language\u0022 content\u003d\u0022en\u0022/\u003e\n+ \u003cscript src\u003d\u0022/lws-common.js\u0022\u003e\u003c/script\u003e\n \u003ctitle\u003eMinimal Websocket test app\u003c/title\u003e\n \u003cstyle type\u003d\u0022text/css\u0022\u003e\n \tspan.title { font-size:18pt; font: Arial; font-weight:normal; text-align:center; color:#000000; }\n@@ -353,6 +354,8 @@ function san(s)\n \treturn s;\n }\n \n+lws_gray_out(true,{'zindex':'499'});\n+\n /* BrowserDetect came from http://www.quirksmode.org/js/detect.html */\n \n var BrowserDetect \u003d {\n@@ -665,6 +668,7 @@ function ot_req_close() {\n \t\t\tdocument.getElementById(\u0022wslm_status\u0022).innerHTML \u003d\n \t\t\t\t\u0022 \u003cb\u003ewebsocket connection opened\u003c/b\u003e\u003cbr\u003e\u0022 +\n \t\t\t\tsan(socket_lm.extensions);\n+\t\t\tlws_gray_out(false);\n \t\t} \n \n \t\tsocket_lm.onmessage \u003dfunction got_packet(msg) {\n@@ -693,6 +697,7 @@ function ot_req_close() {\n \t\tsocket_lm.onclose \u003d function(){\n \t\t\tdocument.getElementById(\u0022wslm_statustd\u0022).style.backgroundColor \u003d \u0022#ff4040\u0022;\n \t\t\tdocument.getElementById(\u0022wslm_status\u0022).textContent \u003d \u0022 websocket connection CLOSED \u0022;\n+\t\t\tlws_gray_out(true,{'zindex':'499'});\n \t\t}\n \t} catch(exception) {\n \t\talert('\u003cp\u003eError' + exception); \n","s":{"c":1752654970,"u": 4203}} ],"g": 5488,"chitpc": 0,"ehitpc": 0,"indexed":0 , "ab": 0, "si": 0, "db":0, "di":0, "sat":0, "lfc": "0000"}