Documentation
¶
Index ¶
- Variables
- func Dial(network, address string) (net.Conn, error)
- func DialContext(ctx context.Context, network, address string) (net.Conn, error)
- func GRPCDialer(ctx context.Context, address string) (net.Conn, error)
- type WebSocket
- func (ws *WebSocket) Close() error
- func (ws *WebSocket) LocalAddr() net.Addr
- func (ws *WebSocket) Read(buf []byte) (int, error)
- func (ws *WebSocket) RemoteAddr() net.Addr
- func (ws *WebSocket) SetDeadline(future time.Time) (err error)
- func (ws *WebSocket) SetReadDeadline(future time.Time) error
- func (ws *WebSocket) SetWriteDeadline(future time.Time) error
- func (ws *WebSocket) Write(buf []byte) (n int, err error)
Constants ¶
This section is empty.
Variables ¶
var ( //EnableBlobStreaming allows the browser provided Websocket's streaming // interface to be used, if supported. EnableBlobStreaming bool = true //ErrWebsocketClosed is returned when operations are performed on a closed Websocket ErrWebsocketClosed = errors.New("WebSocket: Web socket is closed") )
Functions ¶
func Dial ¶
Dial is a standard legacy network dialer that returns a websocket-based connection. See: DialContext for details on the network and address.
func DialContext ¶
DialContext is a standard context-aware network dialer that returns a websocket-based connection. The address is a URL that should be in the form of "ws://host/path..." for unsecured websockets and "wss://host/path..." for secured websockets. If tunnel a TLS based protocol over a "wss://..." websocket you will get TLS twice, once on the websocket using the browsers TLS stack and another using the Go (or other compiled) TLS stack.
func GRPCDialer ¶
GRPCDialer is a helper that can be used with grpc.WithContextDialer to call DialContext. The address provided to the calling grpc.Dial should be in the form "passthrough:///"+websocketURL where websocketURL matches the description in DialContext.
Types ¶
type WebSocket ¶
type WebSocket struct {
URL string
// contains filtered or unexported fields
}
WebSocket is a Go struct that wraps the web browser's JavaScript websocket object and provides a net.Conn interface
func New ¶
New returns a new WebSocket using the provided dial context and websocket URL. The URL should be in the form of "ws://host/path..." for unsecured websockets and "wss://host/path..." for secured websockets. If tunnel a TLS based protocol over a "wss://..." websocket you will get TLS twice, once on the websocket using the browsers TLS stack and another using the Go (or other compiled) TLS stack.
func (*WebSocket) LocalAddr ¶
LocalAddr returns a dummy websocket address to satisfy net.Conn, see: wsAddr
func (*WebSocket) RemoteAddr ¶
RemoteAddr returns a dummy websocket address to satisfy net.Conn, see: wsAddr
func (*WebSocket) SetReadDeadline ¶
SetReadDeadline implements the Conn SetReadDeadline method
func (*WebSocket) SetWriteDeadline ¶
SetWriteDeadline implements the Conn SetWriteDeadline method