websocket

package
v0.0.1-0...-d82520f Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ChatHeader    = []byte("chat")
	JoinAction    = []byte("jo")
	LeaveAction   = []byte("lv")
	SayAction     = []byte("sa")
	WhisperAction = []byte("wh")
)

Required for Chat Messages

View Source
var (
	SessionHeader = []byte("sess")
)

Required for Session Messages

Functions

This section is empty.

Types

type WebSocket

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

func New

func New(sessions storage.Sessions, broker *services.Broker, mel *melody.Melody) *WebSocket

func (*WebSocket) Broadcast

func (ws *WebSocket) Broadcast(msg []byte, room string)

func (*WebSocket) Chat

func (ws *WebSocket) Chat(melSess *melody.Session, voidSess models.Session, room string, msg []byte)

func (*WebSocket) Connect

func (ws *WebSocket) Connect(s *melody.Session)

func (*WebSocket) Disconnect

func (ws *WebSocket) Disconnect(s *melody.Session)

func (*WebSocket) HTTPRequest

func (ws *WebSocket) HTTPRequest(w http.ResponseWriter, r *http.Request)

func (*WebSocket) Join

func (ws *WebSocket) Join(melSess *melody.Session, voidSess models.Session, room string)

func (*WebSocket) Leave

func (ws *WebSocket) Leave(melSess *melody.Session, voidSess models.Session, room string)

func (*WebSocket) Message

func (ws *WebSocket) Message(s *melody.Session, msg []byte)

func (*WebSocket) Session

func (ws *WebSocket) Session(melSess *melody.Session, voidSess models.Session)

func (*WebSocket) ToName

func (ws *WebSocket) ToName(name string) func(*melody.Session) bool

func (*WebSocket) ToRoom

func (ws *WebSocket) ToRoom(room string) func(*melody.Session) bool

func (*WebSocket) Voidsent

func (ws *WebSocket) Voidsent(melSess *melody.Session, voidSess models.Session, body []byte)

Jump to

Keyboard shortcuts

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