wss-over-h2: show feedback in test page if active
This commit is contained in:
parent
3e4a1f3b0e
commit
a4161780df
7 changed files with 19 additions and 7 deletions
|
@ -1633,6 +1633,7 @@ if (NOT LWS_WITHOUT_TESTAPPS)
|
|||
"${PROJECT_SOURCE_DIR}/test-apps/candide.zip"
|
||||
"${PROJECT_SOURCE_DIR}/test-apps/libwebsockets.org-logo.png"
|
||||
"${PROJECT_SOURCE_DIR}/test-apps/http2.png"
|
||||
"${PROJECT_SOURCE_DIR}/test-apps/wss-over-h2.png"
|
||||
"${PROJECT_SOURCE_DIR}/test-apps/lws-common.js"
|
||||
"${PROJECT_SOURCE_DIR}/test-apps/test.html")
|
||||
|
||||
|
|
|
@ -10,6 +10,8 @@ News
|
|||
|
||||
## Lws has the first official ws-over-h2 server support
|
||||
|
||||

|
||||
|
||||
There's a new standard on the RFC track that enables multiplexing ws connections
|
||||
over an http/2 link. Compared to making individual tcp and tls connections for
|
||||
each ws link back to the same server, this makes your site start up radically
|
||||
|
|
|
@ -49,6 +49,7 @@ struct per_session_data__lws_status {
|
|||
struct per_session_data__lws_status *walk_next;
|
||||
unsigned char subsequent:1;
|
||||
unsigned char changed_partway:1;
|
||||
unsigned char wss_over_h2:1;
|
||||
};
|
||||
|
||||
struct per_vhost_data__lws_status {
|
||||
|
@ -114,6 +115,8 @@ callback_lws_status(struct lws *wsi, enum lws_callback_reasons reason,
|
|||
pss->next = vhd->live_pss_list;
|
||||
vhd->live_pss_list = pss;
|
||||
|
||||
pss->wss_over_h2 = !!len;
|
||||
|
||||
time(&pss->time_est);
|
||||
pss->wsi = wsi;
|
||||
strcpy(pss->user_agent, "unknown");
|
||||
|
@ -129,9 +132,11 @@ callback_lws_status(struct lws *wsi, enum lws_callback_reasons reason,
|
|||
n = LWS_WRITE_TEXT | LWS_WRITE_NO_FIN;;
|
||||
p += lws_snprintf(p, end - p,
|
||||
"{ \"version\":\"%s\","
|
||||
" \"wss_over_h2\":\"%d\","
|
||||
" \"hostname\":\"%s\","
|
||||
" \"wsi\":\"%d\", \"conns\":[",
|
||||
lws_get_library_version(),
|
||||
pss->wss_over_h2,
|
||||
lws_canonical_hostname(vhd->context),
|
||||
vhd->count_live_pss);
|
||||
pss->walk = WALK_LIST;
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 2 KiB |
|
@ -346,7 +346,7 @@ int main(int argc, char **argv)
|
|||
}
|
||||
info.gid = -1;
|
||||
info.uid = -1;
|
||||
info.max_http_header_pool = 1;
|
||||
info.max_http_header_pool = 16;
|
||||
info.timeout_secs = 5;
|
||||
info.options = opts | LWS_SERVER_OPTION_LIBUV;
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<title>Minimal Websocket test app</title>
|
||||
<style type="text/css">
|
||||
span.title { font-size:18pt; font-family: Arial; font-weight:normal; text-align:center; color:#000000; }
|
||||
.browser { font-size:18pt; font-family: Arial; font-weight:normal; text-align:center; color:#ffff00; vertical-align:middle; text-align:center; background:#d0b070; padding:12px; -webkit-border-radius:10px; border-radius:10px;}
|
||||
.browser { font-size:12pt; font-family: Arial; font-weight:normal; text-align:center; color:#ffff00; vertical-align:middle; text-align:center; background:#d0b070; padding:12px; -webkit-border-radius:10px; border-radius:10px;}
|
||||
.group2 { vertical-align:middle;
|
||||
text-align:center;
|
||||
background:#f0f0e0;
|
||||
|
@ -95,11 +95,11 @@
|
|||
<td valign=middle align=center>
|
||||
<a href="https://libwebsockets.org">
|
||||
<img src="libwebsockets.org-logo.png"></a></td><td>
|
||||
<section class="browser">Detected Browser:
|
||||
<section class="browser">
|
||||
<div id=brow>...</div></section>
|
||||
</td>
|
||||
<td width="64" id="transport">
|
||||
</td>
|
||||
<td width="64" height="64" id="wstransport"></td>
|
||||
<td width="64" height="64" id="transport"></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
@ -525,7 +525,7 @@ if (location.search) {
|
|||
params[nv[0]] = nv[1] || true;
|
||||
}
|
||||
}
|
||||
|
||||
window.onload = function() {
|
||||
var transport_protocol = "";
|
||||
|
||||
if ( performance && performance.timing.nextHopProtocol ) {
|
||||
|
@ -545,7 +545,8 @@ var value = "nextHopProtocol" in p[i];
|
|||
console.log("transport protocol " + transport_protocol);
|
||||
|
||||
if (transport_protocol == "h2")
|
||||
document.getElementById("transport").innerHTML = "<img src=\"/http2.png\">";
|
||||
document.getElementById("transport").innerHTML = "<img src=\"./http2.png\">";
|
||||
}
|
||||
|
||||
var mirror_name = "";
|
||||
if (params.mirror)
|
||||
|
@ -628,6 +629,9 @@ document.getElementById("number").textContent = get_appropriate_ws_url(mirror_na
|
|||
|
||||
jso = JSON.parse(msg.data);
|
||||
|
||||
if (jso.wss_over_h2 == "1")
|
||||
document.getElementById("wstransport").innerHTML = "<img src=\"./wss-over-h2.png\">";
|
||||
|
||||
document.getElementById("servinfo").innerHTML =
|
||||
"<table><tr><td class=l>Build info</td><td>"+
|
||||
san(jso.version) + "</td></tr>" +
|
||||
|
|
BIN
test-apps/wss-over-h2.png
Normal file
BIN
test-apps/wss-over-h2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.7 KiB |
Loading…
Add table
Reference in a new issue