Skip to content

Instantly share code, notes, and snippets.

@Kotlin-Native
Created July 10, 2015 08:03
Show Gist options
  • Select an option

  • Save Kotlin-Native/cfc656785c28e29494e1 to your computer and use it in GitHub Desktop.

Select an option

Save Kotlin-Native/cfc656785c28e29494e1 to your computer and use it in GitHub Desktop.
var messageReceived = function(event) {
var eventData = event.data.toString();
console.log("Received via socket: "+eventData);
};
var socket = new WebSocket("ws://www.example.com/mywebsocketapp/myspecializedsocket/do.connect");
socket.onmessage = messageReceived;
//send text to server
socket.send("testtext");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment