Skip to content

Commit 921b854

Browse files
committed
Improve docs
1 parent 3156691 commit 921b854

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,10 @@ into your existing Go webserver to provide WebSocket reverse proxy.
1010
go get github.com/koding/websocketproxy
1111
```
1212

13-
## Usage
13+
## Example
1414

1515
Below is a simple app that runs on a server and proxies to the given backend url
1616

17-
```bash
18-
go run proxy.go -backend ws://example.com -port 80
19-
```
20-
2117
```go
2218
package main
2319

@@ -46,3 +42,11 @@ func main() {
4642
}
4743
}
4844
```
45+
46+
Save it as `proxy.go` and run as:
47+
48+
49+
```bash
50+
go run proxy.go -backend ws://example.com -port 80
51+
```
52+

websocketproxy.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ type WebsocketProxy struct {
3636
// WebSocket connection. If nil, DefaultUpgrader is used.
3737
Upgrader *websocket.Upgrader
3838

39-
// Dialer contains options for connecting to WebSocket server.
39+
// Dialer contains options for connecting to WebSocket server. If nil,
40+
// DefaultDialer is used.
4041
Dialer *websocket.Dialer
4142
}
4243

0 commit comments

Comments
 (0)