Create HTML5 Websocket Server - Javascript Language Basics

Javascript examples for Language Basics:WebSocket

Description

Create HTML5 Websocket Server

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <script type="text/javascript">
        var socket = new WebSocket('ws://localhost:8080/websession');
        socket.onopen = function() {
            console.log('handshake successfully established. May send data now...');
        };/*w ww . j  av a 2s.  c  o  m*/
        socket.onclose = function() {
            console.log('connection closed');
        };
    
      </script> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials