File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed
Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ go get github.com/koding/websocketproxy
1212
1313## Example
1414
15- Below is a simple app that runs on a server and proxies to the given backend URL
15+ Below is a simple server that proxies to the given backend URL
1616
1717``` go
1818package main
@@ -26,7 +26,6 @@ import (
2626)
2727
2828var (
29- flagPort = flag.String (" port" , " 3000" , " Port of the reverse proxy" )
3029 flagBackend = flag.String (" backend" , " " , " Backend URL for proxying" )
3130)
3231
@@ -36,7 +35,7 @@ func main() {
3635 log.Fataln (err)
3736 }
3837
39- err := http.ListenAndServe (" :" +*flagPort , websocketproxy.NewProxy (u))
38+ err := http.ListenAndServe (" :80 " , websocketproxy.NewProxy (u))
4039 if err != nil {
4140 log.Fataln (err)
4241 }
@@ -45,8 +44,11 @@ func main() {
4544
4645Save it as ` proxy.go ` and run as:
4746
48-
4947``` bash
50- go run proxy.go -backend ws://example.com -port 80
48+ go run proxy.go -backend ws://example.com:3000
5149```
5250
51+ Now all incoming WebSocket requests coming to this server will be proxied to
52+ ` ws://example.com:3000 `
53+
54+
Original file line number Diff line number Diff line change @@ -90,7 +90,6 @@ func TestProxy(t *testing.T) {
9090 return true
9191 }
9292 }
93-
9493 return false
9594 }
9695
You can’t perform that action at this time.
0 commit comments