aboutsummaryrefslogtreecommitdiffstats
path: root/signaling-server/node_modules/socket.io/node_modules/socket.io-client/lib/vendor/web-socket-js/sample.html
diff options
context:
space:
mode:
Diffstat (limited to 'signaling-server/node_modules/socket.io/node_modules/socket.io-client/lib/vendor/web-socket-js/sample.html')
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/lib/vendor/web-socket-js/sample.html75
1 files changed, 75 insertions, 0 deletions
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/lib/vendor/web-socket-js/sample.html b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/lib/vendor/web-socket-js/sample.html
new file mode 100644
index 0000000..8ac4dca
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/lib/vendor/web-socket-js/sample.html
@@ -0,0 +1,75 @@
+<!--
+ Lincense: Public Domain
+-->
+
+<html><head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <title>Sample of web_socket.js</title>
+
+ <!-- Include these three JS files: -->
+ <script type="text/javascript" src="swfobject.js"></script>
+ <script type="text/javascript" src="web_socket.js"></script>
+
+ <script type="text/javascript">
+
+ // Set URL of your WebSocketMain.swf here:
+ WEB_SOCKET_SWF_LOCATION = "WebSocketMain.swf";
+ // Set this to dump debug message from Flash to console.log:
+ WEB_SOCKET_DEBUG = true;
+
+ // Everything below is the same as using standard WebSocket.
+
+ var ws;
+
+ function init() {
+
+ // Connect to Web Socket.
+ // Change host/port here to your own Web Socket server.
+ ws = new WebSocket("ws://localhost:10081/");
+
+ // Set event handlers.
+ ws.onopen = function() {
+ output("onopen");
+ };
+ ws.onmessage = function(e) {
+ // e.data contains received string.
+ output("onmessage: " + e.data);
+ };
+ ws.onclose = function() {
+ output("onclose");
+ };
+ ws.onerror = function() {
+ output("onerror");
+ };
+
+ }
+
+ function onSubmit() {
+ var input = document.getElementById("input");
+ // You can send message to the Web Socket using ws.send.
+ ws.send(input.value);
+ output("send: " + input.value);
+ input.value = "";
+ input.focus();
+ }
+
+ function onCloseClick() {
+ ws.close();
+ }
+
+ function output(str) {
+ var log = document.getElementById("log");
+ var escaped = str.replace(/&/, "&amp;").replace(/</, "&lt;").
+ replace(/>/, "&gt;").replace(/"/, "&quot;"); // "
+ log.innerHTML = escaped + "<br>" + log.innerHTML;
+ }
+
+ </script>
+</head><body onload="init();">
+ <form onsubmit="onSubmit(); return false;">
+ <input type="text" id="input">
+ <input type="submit" value="Send">
+ <button onclick="onCloseClick(); return false;">close</button>
+ </form>
+ <div id="log"></div>
+</body></html>