<!DOCTYPE HTML>

<html>
   <head>
      <title>DpvCam Webcontrol</title>
      <meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
      <script type = "text/javascript">
         function WebSocketTest() {
            
            var elem = document.getElementById("image");
            if ("WebSocket" in window) {              
               // Let us open a web socket
               var ws = new WebSocket("ws://127.0.0.1:9003");

               ws.onmessage = function(evt) {
                    elem.setAttribute('src','data:image/jpeg;base64,' + evt.data);
               };

            } else {
              
               // The browser doesn't support WebSocket
               alert("WebSocket NOT supported by your Browser!");
            }
         }
      </script>
		
   </head>
   
   <body>
      <div id = "sse">
         <a href = "javascript:WebSocketTest()">Run WebSocket</a>
      </div>
      <img id="image" src="" width="1280" height="720"/>
      <p id="error"></p>  
   </body>
</html>