websocket

package
v0.0.0-...-2479739 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

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

func NewClientConnection

func NewClientConnection(
	serverAddr string,
	username string,
	logger log.Logger,
) (*Connection, error)

func NewConnection

func NewConnection(
	wsConn *ws.Conn,
	logger log.Logger,
) *Connection

func (*Connection) Close

func (c *Connection) Close(err error) error

func (*Connection) Closed

func (c *Connection) Closed() bool

func (*Connection) Err

func (c *Connection) Err() error

func (*Connection) ReadEvent

func (c *Connection) ReadEvent() (chat.Event, error)

func (*Connection) SendEvent

func (c *Connection) SendEvent(e chat.Event) error

func (*Connection) Wait

func (c *Connection) Wait() error

func (*Connection) WaitContext

func (c *Connection) WaitContext(ctx context.Context) error

type Message

type Message struct {
	Name string     `json:"name"`
	Data chat.Event `json:"data"`
}

func (*Message) UnmarshalJSON

func (m *Message) UnmarshalJSON(data []byte) error

type MessageRaw

type MessageRaw struct {
	Name string           `json:"name"`
	Data *json.RawMessage `json:"data"`
}

type Server

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

func NewServer

func NewServer(logger log.Logger) *Server

func (*Server) Start

func (s *Server) Start(addr string) error

Jump to

Keyboard shortcuts

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