Created
March 21, 2016 20:22
-
-
Save edrex/7af8da336fbd1ec6a2f9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| localhost:2020 { | |
| log proxy.log | |
| proxy /echo localhost:2021 { | |
| websocket | |
| } | |
| } | |
| localhost:2021 { | |
| log websocket.log | |
| websocket /echo cat | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!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> |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Connect to http://localhost:2020/ to test proxying to caddy websocket.