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
12
12
13
13
## Example
14
14
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
16
16
17
17
``` go
18
18
package main
@@ -26,7 +26,6 @@ import (
26
26
)
27
27
28
28
var (
29
- flagPort = flag.String (" port" , " 3000" , " Port of the reverse proxy" )
30
29
flagBackend = flag.String (" backend" , " " , " Backend URL for proxying" )
31
30
)
32
31
@@ -36,7 +35,7 @@ func main() {
36
35
log.Fataln (err)
37
36
}
38
37
39
- err := http.ListenAndServe (" :" +*flagPort , websocketproxy.NewProxy (u))
38
+ err := http.ListenAndServe (" :80 " , websocketproxy.NewProxy (u))
40
39
if err != nil {
41
40
log.Fataln (err)
42
41
}
@@ -45,8 +44,11 @@ func main() {
45
44
46
45
Save it as ` proxy.go ` and run as:
47
46
48
-
49
47
``` bash
50
- go run proxy.go -backend ws://example.com -port 80
48
+ go run proxy.go -backend ws://example.com:3000
51
49
```
52
50
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) {
90
90
return true
91
91
}
92
92
}
93
-
94
93
return false
95
94
}
96
95
You can’t perform that action at this time.
0 commit comments