sockets

package
v0.0.0-...-53ae92a Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func New

func New() Client

func (*Client) Add

func (self *Client) Add(appId string, conn *websocket.Conn) *Socket

func (*Client) Del

func (self *Client) Del(appId string, id string)

func (*Client) Get

func (self *Client) Get(appId string) *Socket

type Event

type Event struct {
	ID     uint64         `json:"id"`
	Type   EventType      `json:"type"`
	Body   map[string]any `json:"body"`
	SentAt time.Time      `json:"sent_at"`
}

func NewEvent

func NewEvent(id uint64, t EventType, body map[string]any) Event

type EventType

type EventType string
const (
	Ack EventType = "ack"
)

func (EventType) Valid

func (self EventType) Valid() bool

type Socket

type Socket struct {
	ID        string
	CreatedAt time.Time
	// contains filtered or unexported fields
}

func NewSocket

func NewSocket(conn *websocket.Conn) *Socket

func (*Socket) Read

func (self *Socket) Read() (Event, error)

func (*Socket) Send

func (self *Socket) Send(event Event) error

Jump to

Keyboard shortcuts

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