message

package
v3.37.3 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2024 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HttpInstance = &Http{
	Received: make(chan string),
	ToSend:   make(chan Message),
}

Functions

This section is empty.

Types

type Http

type Http struct {
	Received chan string  // received messages from web
	ToSend   chan Message // messages to send to web
}

func (*Http) GetHandle

func (p *Http) GetHandle(c *gin.Context)

func (*Http) Receive

func (p *Http) Receive() (string, error)

func (*Http) Send

func (p *Http) Send(message Message) error

func (*Http) SendHandle

func (p *Http) SendHandle(c *gin.Context)

func (*Http) WaitReceive

func (p *Http) WaitReceive(d int) (string, error)

func (*Http) WaitSend

func (p *Http) WaitSend(message Message, d int) error

type Message

type Message struct {
	Type    string      `json:"type"`
	Content interface{} `json:"content"`
}

type Messenger

type Messenger interface {
	Send(Message) error
	Receive() (string, error)
	WaitSend(Message, int) error
	WaitReceive(int) (string, error)
}

func GetMessenger

func GetMessenger() Messenger

type Req

type Req struct {
	Message string `json:"message" form:"message"`
}

Jump to

Keyboard shortcuts

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