Categorygithub.com/lossdev/websockit
modulepackage
1.0.0
Repository: https://github.com/lossdev/websockit.git
Documentation: pkg.go.dev

# README

websockit

GoDoc Go Report Card

Golang gorilla/websocket wrapper that provides customizable client and server implementations, read and write helpers, close and error handlers, and more

Installation

go get github.com/lossdev/websockit

Documentation

On pkg.go.dev

Examples

An echo server and client example are provided in the cmd directory

# Packages

No description provided by the author

# Functions

ClientWithHandshakeTimeout sets a timeout duration for the websocket handshake.
ClientWithProxy takes a proxy func and runs each new http.Request through this func.
ClientWithReadBufferSize sets the size limit (in bytes) of read buffers in the websocket.
ClientWithSubprotocols should be used to set the client's preferred subprotocols.
ClientWithTLSConfig sets the TLS config for the websocket session.
ClientWithWriteBufferSize sets the size limit (in bytes) of write buffers in the websocket.
NewWebsocket should be called for any new websocket pair, server or client.
PingWithPongLog enables client logs when pong messages are received from the server end of the Websocket connection.
PingWithPongTimeout sets a maximum pongTimeout allowed before the Websocket read exits with a read failure.
ServerWithCheckOriginFunc can override the default CheckOrigin deny policy given the http.Request made to the server.
ServerWithErrorFunc can use a custom HTTP error function - otherwise, http.Error will print errors.
ServerWithHandshakeTimeout sets a timeout duration for the websocket handshake.
ServerWithReadBufferSize sets the size limit (in bytes) of read buffers in the websocket.
ServerWithSubprotocols should be used to set the server's preferred subprotocols.
ServerWithWriteBufferSize sets the size limit (in bytes) of write buffers in the websocket.

# Variables

ErrPingNotEnabled is returned when a client attempts to enter a ping loop without initializing the ping options.

# Structs

Websocket is the embedded struct that websocket clients and servers have in common.
WebsocketClient inherits the Websocket fields and methods, and implements its own unique methods.
WebsocketServer inherits the Websocket fields and methods, and implements its own unique methods.

# Type aliases

ClientPingOption specifies any custom options for the client ping behavior.
WebsocketClientOption specifies any custom options a client websocket connection should have.
WebsocketServerOption specifies any custom options a server websocket connection should have.