message

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

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

Go to latest
Published: Feb 23, 2023 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter map[string]func(*Message) error

Adapter connection message adapter

func NewAdapter

func NewAdapter() *Adapter

NewAdapter create new message adapter

func (Adapter) Exec

func (a Adapter) Exec(msg *Message) (bool, error)

Exec exec message. Return if handler by message type exists and any error rasied.

func (*Adapter) Register

func (a *Adapter) Register(msgtype string, handler func(*Message) error)

Register register message handler by given type.

type Message

type Message struct {
	//Type message type
	Type string
	// Room message room id
	Room string
	//Data message data
	Data interface{}
}

Message connection message struct

func New

func New() *Message

New create new message.

Jump to

Keyboard shortcuts

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