Skip to content

Instantly share code, notes, and snippets.

@edrex
Last active February 10, 2016 01:34
Show Gist options
  • Select an option

  • Save edrex/9863fb4aa68d65229542 to your computer and use it in GitHub Desktop.

Select an option

Save edrex/9863fb4aa68d65229542 to your computer and use it in GitHub Desktop.
localhost
log access.log
proxy /echo http://127.0.0.1:2016 {
websocket
}
<!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>
localhost
log access.log
websocket /echo cat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment