Skip to content

Instantly share code, notes, and snippets.

@desouradeep
Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save desouradeep/cd767d4da1f96aa0e1c6 to your computer and use it in GitHub Desktop.
Save desouradeep/cd767d4da1f96aa0e1c6 to your computer and use it in GitHub Desktop.
Client socket JavaScript
WEB_SOCKET_SWF_LOCATION = "/static/WebSocketMain.swf";
WEB_SOCKET_DEBUG = true;
socket = io.connect('http://' + document.domain + ':' + location.port);
var client_message = "This is a client, I am attemping to communicate";
socket.emit("channel-a", client_message);
console.log("[x] Sent : " + client_message);
socket.on('channel-a', function(message) {
console.log("[x] Received : " + message);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment