Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandleWebSocket ¶
HandleWebSocket returns a new `handler func(*Conn)` that upgrades a client to the websocket protocol, you can pass an optional config.
Types ¶
type Config ¶
type Config struct { // HandshakeTimeout specifies the duration for the handshake to complete. HandshakeTimeout time.Duration // Subprotocols specifies the client's requested subprotocols. Subprotocols []string // Allowed Origin's based on the Origin header, this validate the request origin to // prevent cross-site request forgery. Everything is allowed if left empty. Origins []string // ReadBufferSize and WriteBufferSize specify I/O buffer sizes in bytes. If a buffer // size is zero, then a useful default size is used. The I/O buffer sizes // do not limit the size of the messages that can be sent or received. ReadBufferSize, WriteBufferSize int // EnableCompression specifies if the client should attempt to negotiate // per message compression (RFC 7692). Setting this value to true does not // guarantee that compression will be supported. Currently only "no context // takeover" modes are supported. EnableCompression bool }
Config ...
type Conn ¶
Conn represents connection with its parameters, cookies, query string etc
func (*Conn) Cookies ¶
Cookies is used for getting a cookie value by key Defaults to empty string "" if the cookie doesn't exist. If a default value is given, it will return that value if the cookie doesn't exist.
func (*Conn) Locals ¶
Locals makes it possible to pass interface{} values under string keys scoped to the request and therefore available to all following routes that match the request.
Click to show internal directories.
Click to hide internal directories.