Documentation
¶
Overview ¶
Package wsproxy implements a websocket proxy for grpc-gateway backed services
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WebsocketProxy ¶
WebsocketProxy attempts to expose the underlying handler as a bidi websocket stream with newline-delimited JSON as the content encoding.
The HTTP Authorization header is either populated from the Sec-Websocket-Protocol field or by a cookie. The cookie name defaults to "token" and can be overridden with WithTokenCookieName.
example:
Sec-Websocket-Protocol: Bearer, foobar
is converted to:
Authorization: Bearer foobar
Method can be overwritten with the method query parameter (default "method") in the requested URL.
Types ¶
type Option ¶
type Option func(*Proxy)
Option allows customization of the proxy.
func WithMethodParamOverride ¶
WithMethodParamOverride allows specification of the special http parameter that is used in the proxied streaming request.
func WithPingPong ¶
func WithReadLimit ¶
func WithRequestMutator ¶
func WithRequestMutator(fn RequestMutatorFunc) Option
WithRequestMutator allows a custom RequestMutatorFunc to be supplied.
func WithTimeWait ¶
func WithTokenCookieName ¶
WithTokenCookieName allows specification of the cookie that is supplied as an upstream 'Authorization: Bearer' http header.
type Proxy ¶
type Proxy struct {
ReadLimit int64
// contains filtered or unexported fields
}
Proxy provides websocket transport upgrade to compatible endpoints.
type RequestMutatorFunc ¶
RequestMutatorFunc can supply an alternate outgoing request.
type WsConn ¶
func (WsConn) WriteControl ¶
func (WsConn) WritePreparedMessage ¶
func (ws WsConn) WritePreparedMessage(pm *websocket.PreparedMessage) error