<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script src="http://cdn.socket.io/stable/socket.io.js"></script> <script type="text/javascript"> // Create SocketIO instance, connect var socket = new io.Socket('localhost',{ port: 33333 }); socket.connect(); // Add a connect listener socket.on('connect',function() { console.log('Client has connected to the server!'); }); // Add a connect listener socket.on('message',function(data) { console.log('Received a message from the server!',data); }); // Add a disconnect listener socket.on('disconnect',function() { console.log('The client has disconnected!'); }); // Sends a message to the server via sockets function sendMessageToServer(message) { socket.send(message); } </script> <body> </body> </html>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)