gorilla

package
v0.0.25 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 6, 2026 License: MIT Imports: 11 Imported by: 26 modules, 28 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

DefaultDialer is a gorilla/websocket dialer with all fields set to the default values.

View Source
var DefaultUpgrader = Upgrader(gorilla.Upgrader{})

DefaultUpgrader is a gorilla/websocket Upgrader with all fields set to the default values.

Functions

func Dialer

func Dialer(dialer *gorilla.Dialer, requestHeader http.Header) neffos.Dialer

Dialer is a `neffos.Dialer` type for the gorilla/websocket subprotocol implementation. Should be used on `Dial` to create a new client/client-side connection.

func Upgrader

func Upgrader(upgrader gorilla.Upgrader) neffos.Upgrader

Upgrader is a `neffos.Upgrader` type for the gorilla/websocket subprotocol implementation. Should be used on `New` to construct the neffos server.

Types

type Options

type Options = gorilla.Dialer

Options is just an alias for the `gorilla/websocket.Dialer` struct type.

type Socket

type Socket struct {
	UnderlyingConn *gorilla.Conn
	// contains filtered or unexported fields
}

Socket completes the `neffos.Socket` interface, it describes the underline websocket connection.

It also implements neffos.SocketCloser, neffos.SocketPinger and neffos.SocketReadLimiter.

func (*Socket) Close added in v0.0.25

func (s *Socket) Close(code int, reason string, timeout time.Duration) error

Close sends a close frame with code and reason, waiting at most timeout for the write (one second when timeout is zero), and then closes the connection. A failed close frame write does not stop the close. It is safe to call while other goroutines read and write.

func (*Socket) NetConn

func (s *Socket) NetConn() net.Conn

NetConn returns the underline net connection.

func (*Socket) Ping added in v0.0.25

func (s *Socket) Ping(timeout time.Duration) error

Ping sends a ping frame. With a timeout above zero it then waits up to that long for a pong and returns os.ErrDeadlineExceeded when none arrives. With a zero timeout it returns right after the write. Pongs are only seen while another goroutine is inside ReadData.

func (*Socket) ReadData

func (s *Socket) ReadData(timeout time.Duration) ([]byte, neffos.MessageType, error)

ReadData reads binary or text messages from the remote connection.

A close frame from the remote side is returned as a neffos.CloseError with its code and reason. A message over the read limit returns an error that matches neffos.ErrMessageTooBig, after a close frame with neffos.CloseMessageTooBig was sent and the rest of the input was dropped for up to a second. A pong from the remote side moves the read deadline forward by timeout.

func (*Socket) Request

func (s *Socket) Request() *http.Request

Request returns the http request value.

func (*Socket) SetReadLimit added in v0.0.25

func (s *Socket) SetReadLimit(n int64)

SetReadLimit sets the largest message, in bytes, ReadData accepts. A bigger message closes the connection with neffos.CloseMessageTooBig. n <= 0 removes the limit.

func (*Socket) WriteBinary

func (s *Socket) WriteBinary(body []byte, timeout time.Duration) error

WriteBinary sends a binary message to the remote connection.

func (*Socket) WriteText

func (s *Socket) WriteText(body []byte, timeout time.Duration) error

WriteText sends a text message to the remote connection.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL