gorilla

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package gorilla implements a websocket connection by wrapping gorilla/websocket.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn struct {
	*websocket.Conn
}

Conn implements the Conn interface by wrapping a gorilla/websocket Conn.

func (*Conn) IsNormalClose

func (*Conn) IsNormalClose(err error) bool

IsNormalClose determines if the error message is not an unexpected close error.

func (*Conn) ReadMessage

func (c *Conn) ReadMessage(m *message.Message) error

ReadMessage reads the next message from the GorillaConnection.

func (*Conn) WriteClose

func (c *Conn) WriteClose(reason string) (err error)

WriteClose writes a close message on the connection. The connestion is NOT closed.

func (*Conn) WriteMessage

func (c *Conn) WriteMessage(m message.Message) error

WriteMessage writes the message as json to the GorillaConnection.

func (*Conn) WritePing

func (c *Conn) WritePing() error

WritePing writes a ping message on the GorillaConnection.

type Upgrader

type Upgrader struct {
	*websocket.Upgrader
}

Upgrader implements the socket.Upgrader interface by wrapping a gorilla/websocket Upgrader.

func NewUpgrader

func NewUpgrader() *Upgrader

NewUpgrader returns a upgrader tha creates gorilla websocket connections.

func (*Upgrader) Upgrade

func (u *Upgrader) Upgrade(w http.ResponseWriter, r *http.Request) (*Conn, error)

Upgrade creates a Conn from the http request.

Jump to

Keyboard shortcuts

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