@@ -16,58 +16,39 @@ Usage:
16
16
```
17
17
18
18
19
- # Package wsproxy
19
+ # wsproxy
20
+ import "github.com/tmc/grpc-websocket-proxy/wsproxy"
20
21
21
- ` import "github.com/tmc/grpc-websocket-proxy/wsproxy" `
22
-
23
- * [ Overview] ( #pkg-overview )
24
- * [ Index] ( #pkg-index )
25
-
26
- ## <a name =" pkg-overview " >Overview</a >
27
22
Package wsproxy implements a websocket proxy for grpc-gateway backed services
28
23
24
+ ## Usage
29
25
30
-
31
-
32
- ## <a name =" pkg-index " >Index</a >
33
- * [ Variables] ( #pkg-variables )
34
- * [ func WebsocketProxy(h http.Handler) http.HandlerFunc] ( #WebsocketProxy )
35
-
36
-
37
- #### <a name =" pkg-files " >Package files</a >
38
- [ doc.go] ( /src/github.com/tmc/grpc-websocket-proxy/wsproxy/doc.go ) [ websocket_proxy.go] ( /src/github.com/tmc/grpc-websocket-proxy/wsproxy/websocket_proxy.go )
39
-
40
-
41
-
42
- ## <a name =" pkg-variables " >Variables</a >
43
- ``` go
26
+ ``` go
44
27
var (
45
- MethodOverrideParam = " method"
46
- TokenCookieName = " token"
28
+ MethodOverrideParam = " method"
29
+ TokenCookieName = " token"
47
30
)
48
31
```
49
32
33
+ #### func WebsocketProxy
50
34
51
- ## <a name =" WebsocketProxy " >func</a > [ WebsocketProxy] ( /src/target/websocket_proxy.go?s=758:810#L21 )
52
- ``` go
35
+ ``` go
53
36
func WebsocketProxy (h http .Handler ) http .HandlerFunc
54
37
```
55
- WebsocketProxy attempts to expose the underlying handler as a bidi websocket stream with newline-delimited
56
- JSON as the content encoding.
38
+ WebsocketProxy attempts to expose the underlying handler as a bidi websocket
39
+ stream with newline-delimited JSON as the content encoding.
57
40
58
- The HTTP Authorization header is either populated from the Sec-Websocket-Protocol field or by a cookie.
59
- The cookie name is specified by the TokenCookieName value.
41
+ The HTTP Authorization header is either populated from the
42
+ Sec-Websocket-Protocol field or by a cookie. The cookie name is specified by the
43
+ TokenCookieName value.
60
44
61
45
example:
62
46
63
-
64
- Sec-Websocket-Protocol: Bearer, foobar
47
+ Sec-Websocket-Protocol: Bearer, foobar
65
48
66
49
is converted to:
67
50
51
+ Authorization: Bearer foobar
68
52
69
- Authorization: Bearer foobar
70
-
71
- Method can be overwritten with the MethodOverrideParam get parameter in the requested URL
72
-
73
-
53
+ Method can be overwritten with the MethodOverrideParam get parameter in the
54
+ requested URL
0 commit comments