client

package
v0.0.0-...-f9e6952 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const DEFAULT_ORIGIN = "http://127.0.0.1"

Variables

This section is empty.

Functions

This section is empty.

Types

type IMessageHandler

type IMessageHandler interface {
	Exec(message *Message) error
}

type Message

type Message struct {
	Org     int    `json:"org"`     // 归属组织
	Topic   int    `json:"topic"`   // 主题
	Content string `json:"content"` // 内容
}

type TransportMessageToCC

type TransportMessageToCC struct {
}

func (*TransportMessageToCC) Exec

func (t2CC *TransportMessageToCC) Exec(message *Message) error

type WebSocket

type WebSocket struct {
	Stop chan bool
	// contains filtered or unexported fields
}

func NewWebSocket

func NewWebSocket(uri string) (ws *WebSocket, err error)

func (*WebSocket) Close

func (ws *WebSocket) Close() (err error)

func (*WebSocket) OnMessage

func (ws *WebSocket) OnMessage(handler IMessageHandler)

func (*WebSocket) Receive

func (ws *WebSocket) Receive() string

func (*WebSocket) ReceiveJson

func (ws *WebSocket) ReceiveJson(ref interface{})

func (*WebSocket) Send

func (ws *WebSocket) Send(message string) (err error)

func (*WebSocket) SendJson

func (ws *WebSocket) SendJson(ref interface{}) (err error)

Jump to

Keyboard shortcuts

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