Skip to content

Instantly share code, notes, and snippets.

@edrex
Created February 10, 2016 20:35
Show Gist options
  • Select an option

  • Save edrex/61ba42e4c1cb7c82b25a to your computer and use it in GitHub Desktop.

Select an option

Save edrex/61ba42e4c1cb7c82b25a to your computer and use it in GitHub Desktop.
::1 - [10/Feb/2016:12:35:39 -0800] "GET / HTTP/1.1" 200 522
localhost
log access.log
websocket /echo cat
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
</head>
<body>
<script>
function testEchoSocket(path) {
var s = new WebSocket('ws://'+location.hostname+':'+location.port + path);
s.onmessage = function (event) {
console.log(event.data);
}
s.onopen = function (event) {
s.send("ohai");
}
}
testEchoSocket('/echo');
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment