models

package
v0.0.0-...-0b3c072 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMessageBuf

func NewMessageBuf(topic string, v any) ([]byte, error)

Types

type Client

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

func NewClient

func NewClient(conn *websocket.Conn) Client

func (*Client) Close

func (c *Client) Close() error

func (*Client) Id

func (c *Client) Id() string

func (*Client) Ping

func (c *Client) Ping() error

func (*Client) Read

func (c *Client) Read() ([]byte, error)

func (*Client) Write

func (c *Client) Write(b []byte) error

type Message

type Message struct {
	Topic   string          `json:"topic"`
	Payload json.RawMessage `json:"payload"`
}

func NewMessage

func NewMessage(topic string, message any) (Message, error)

type MessageHandler

type MessageHandler interface {
	//TODO: change to clientId, topic, payload
	UpdateMessage(client Client, message Message)
	HandlerName() string
}

Jump to

Keyboard shortcuts

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