Versions in this module Expand all Collapse all v1 v1.4.0 Feb 2, 2026 Changes in this version + const CloseAbnormalClosure + const CloseGoingAway + const CloseInternalServerErr + const CloseInvalidFramePayloadData + const CloseMandatoryExtension + const CloseMessageTooBig + const CloseNoStatusReceived + const CloseNormalClosure + const ClosePolicyViolation + const CloseProtocolError + const CloseServiceRestart + const CloseTLSHandshake + const CloseTryAgainLater + const CloseUnsupportedData + var ErrClosed = errors.New("melody instance is closed") + var ErrMessageBufferFull = errors.New("session message buffer is full") + var ErrSessionClosed = errors.New("session is closed") + var ErrWriteClosed = errors.New("tried to write to closed a session") + func FormatCloseMessage(closeCode int, text string) []byte + type Config struct + ConcurrentMessageHandling bool + MaxMessageSize int64 + MessageBufferSize int + PingPeriod time.Duration + PongWait time.Duration + WriteWait time.Duration + type Melody struct + Config *Config + Upgrader *websocket.FastHTTPUpgrader + func New() *Melody + func NewWithConfig(config *Config) *Melody + func (m *Melody) Broadcast(msg []byte) error + func (m *Melody) BroadcastBinary(msg []byte) error + func (m *Melody) BroadcastBinaryFilter(msg []byte, fn func(*Session) bool) error + func (m *Melody) BroadcastBinaryFilterWithDeadline(msg []byte, deadline time.Duration, fn func(*Session) bool) error + func (m *Melody) BroadcastBinaryOthers(msg []byte, s *Session) error + func (m *Melody) BroadcastBinaryWithDeadline(msg []byte, deadline time.Duration) error + func (m *Melody) BroadcastFilter(msg []byte, fn func(*Session) bool) error + func (m *Melody) BroadcastFilterWithDeadline(msg []byte, deadline time.Duration, fn func(*Session) bool) error + func (m *Melody) BroadcastJson(obj interface{}) error + func (m *Melody) BroadcastJsonFilter(obj interface{}, fn func(*Session) bool) error + func (m *Melody) BroadcastMultiple(msg []byte, sessions []*Session) error + func (m *Melody) BroadcastOthers(msg []byte, s *Session) error + func (m *Melody) BroadcastWithDeadline(msg []byte, deadline time.Duration) error + func (m *Melody) Close() error + func (m *Melody) CloseWithMsg(msg []byte) error + func (m *Melody) HandleClose(fn func(*Session, int, string) error) + func (m *Melody) HandleConnect(fn func(*Session)) + func (m *Melody) HandleDisconnect(fn func(*Session)) + func (m *Melody) HandleError(fn func(*Session, error)) + func (m *Melody) HandleMessage(fn func(*Session, []byte)) + func (m *Melody) HandleMessageBinary(fn func(*Session, []byte)) + func (m *Melody) HandlePong(fn func(*Session)) + func (m *Melody) HandleRequest(ctx *fasthttp.RequestCtx) error + func (m *Melody) HandleRequestWithKeys(ctx *fasthttp.RequestCtx, keys map[string]any) error + func (m *Melody) HandleSentMessage(fn func(*Session, []byte)) + func (m *Melody) HandleSentMessageBinary(fn func(*Session, []byte)) + func (m *Melody) IsClosed() bool + func (m *Melody) Len() int + func (m *Melody) Sessions() ([]*Session, error) + type Session struct + Keys map[string]any + Request *fasthttp.Request + func (s *Session) Close() error + func (s *Session) CloseWithMsg(msg []byte) error + func (s *Session) Get(key string) (value any, exists bool) + func (s *Session) IsClosed() bool + func (s *Session) LocalAddr() net.Addr + func (s *Session) MustGet(key string) any + func (s *Session) RemoteAddr() net.Addr + func (s *Session) Set(key string, value any) + func (s *Session) UnSet(key string) + func (s *Session) WebsocketConnection() *websocket.Conn + func (s *Session) Write(msg []byte) error + func (s *Session) WriteBinary(msg []byte) error + func (s *Session) WriteBinaryWithDeadline(msg []byte, deadline time.Duration) error + func (s *Session) WriteWithDeadline(msg []byte, deadline time.Duration) error