diff --git a/test-server/test.html b/test-server/test.html
index 49558841..b9e48612 100644
--- a/test-server/test.html
+++ b/test-server/test.html
@@ -77,6 +77,24 @@ run.
+
+libwebsockets "open and close testing"
+
+
+ |
+To help with open and close testing, you can open and close a connection by hand using
+ the buttons.
+ |
+
+
+
Looking for support? http://libwebsockets.org
Join the mailing list: http://ml.libwebsockets.org/mailman/listinfo/libwebsockets
@@ -276,6 +294,39 @@ function reset() {
socket_di.send("reset\n");
}
+var socket_ot;
+
+function ot_open() {
+ if (typeof MozWebSocket != "undefined") {
+ socket_ot = new MozWebSocket(get_appropriate_ws_url(),
+ "dumb-increment-protocol");
+ } else {
+ socket_ot = new WebSocket(get_appropriate_ws_url(),
+ "dumb-increment-protocol");
+ }
+ try {
+ socket_ot.onopen = function() {
+ document.getElementById("ot_statustd").style.backgroundColor = "#40ff40";
+ document.getElementById("ot_status").textContent = " websocket connection opened ";
+ document.getElementById("ot_open_btn").disabled = true;
+ document.getElementById("ot_close_btn").disabled = false;
+ }
+
+ socket_ot.onclose = function(){
+ document.getElementById("ot_statustd").style.backgroundColor = "#ff4040";
+ document.getElementById("ot_status").textContent = " websocket connection CLOSED ";
+ document.getElementById("ot_open_btn").disabled = false;
+ document.getElementById("ot_close_btn").disabled = true;
+
+ }
+ } catch(exception) {
+ alert('Error' + exception);
+ }
+}
+
+function ot_close() {
+ socket_ot.close();
+}
/* lws-mirror protocol */
|