websocket

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChannelContext

type ChannelContext interface {
	router.Context
	Channel() string
	Receive(out interface{}) error
	Send(data interface{}) error
}

type Context added in v0.0.16

type Context interface {
	router.Context
	Closed() bool
	EnableReadCheck()
	Receive(out interface{}) error
	Send(data interface{}) error
}

Context defines a context for websocket functionality.

func NewWebsocketContext added in v0.0.16

func NewWebsocketContext(ctx router.Context, conn *websocket.Conn) Context

type Message

type Message struct {
	Channel *string         `json:"channel"`
	Error   string          `json:"error,omitempty"`
	Payload json.RawMessage `json:"payload"`
}

type WebSocket

type WebSocket struct {
	// contains filtered or unexported fields
}

func New

func New() *WebSocket

func (*WebSocket) ToHandler

func (ws *WebSocket) ToHandler() interface{}

func (*WebSocket) WithAsyncChannel

func (ws *WebSocket) WithAsyncChannel(name string, handler interface{}) *WebSocket

func (*WebSocket) WithCatchAll

func (ws *WebSocket) WithCatchAll(handler interface{}) *WebSocket

func (*WebSocket) WithChannel

func (ws *WebSocket) WithChannel(name string, handler interface{}) *WebSocket

Jump to

Keyboard shortcuts

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