Skip to content

Commit e80aacd

Browse files
committed
README.md: clarify the example
1 parent 953d01b commit e80aacd

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff 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
1818
package main
@@ -26,7 +26,6 @@ import (
2626
)
2727

2828
var (
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

4645
Save 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+

websocketproxy_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ func TestProxy(t *testing.T) {
9090
return true
9191
}
9292
}
93-
9493
return false
9594
}
9695

0 commit comments

Comments
 (0)