refined client-side email address check
[brisk.git] / web / ws.php
1 <?php
2
3 ?>
4 <html>
5 <head>
6 <title>WS</title>
7 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
8 <script type="text/javascript" src="xynt-streaming.js"></script>
9 <script type="text/javascript" src="commons.js"></script>
10 <script type="text/javascript" src="heartbit.js"></script>
11
12 <!-- <script type="text/javascript" src="myconsole.js"></script> -->
13
14 <script type="text/javascript"><!--
15      var socket;
16
17      window.onload = function() {
18         var host = "ws://dodo.birds.van/brisk/xynt_test01.php?isstream=true&transp=websocket&f_test=1"; // SET THIS TO YOUR SERVER
19
20         console.log("QUI");
21         try
22         {
23             socket = new WebSocket(host);
24             console.log('WebSocket - status ' + socket.readyState);
25
26             socket.onopen = function(msg)
27             {
28                 if(this.readyState == 1)
29                 {
30                     console.log("We are now connected to websocket server. readyState = " + this.readyState);
31                 }
32             };
33
34             //Message received from websocket server
35             socket.onmessage = function(msg)
36             {
37                 console.log(" [ + ] Received: " + msg.data);
38             };
39
40             //Connection closed
41             socket.onclose = function(msg)
42             {
43                 console.log("Disconnected - status " + this.readyState);
44             };
45
46             socket.onerror = function()
47             {
48                 console.log("Some error");
49             }
50         }
51
52         catch(ex)
53         {
54             console.log('Some exception : '  + ex);
55         }
56
57      };
58  //-->
59 </script>
60 </head>
61 <body>