ws

package
v0.0.0-...-ed9b52c Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dispatch

func Dispatch(id string, data []byte)

func MessageToMysql

func MessageToMysql()

func Receive

func Receive(node *Node)

func Send

func Send(node *Node)

func SendMsg

func SendMsg(userId string, msg []byte)

func UserOnline

func UserOnline(id string)

UserOnline 设置用户在线

func WsHandler

func WsHandler(w http.ResponseWriter, r *http.Request)

Types

type Chat

type Chat struct {
}

func (Chat) Operate

func (con Chat) Operate(msg Message, data []byte)

type Message

type Message struct {
	Id        int64  `json:"id,omitempty" form:"id"`                 // 消息ID
	Type      int    `json:"type,omitempty" form:"type"`             // 消息类型: 1私聊 9检测心跳
	IsRead    int    `json:"is_read,omitempty" form:"id_read"`       // 消息是否已读
	SendId    string `json:"send_id,omitempty" form:"send_id"`       // 发送者
	ReceiveId string `json:"receive_id,omitempty" form:"receive_id"` // 接收者
	Content   string `json:"content,omitempty" form:"content"`       // 消息的内容
	SendAt    int64  `json:"send_at"`                                // 时间戳
	CreatedAt int64  `json:"created_at,omitempty" form:"created_at"` // 时间戳
}

type Node

type Node struct {
	Conn      *websocket.Conn
	DataQueue chan []byte
	//GroupSets set.Interface
	Id string
}

Jump to

Keyboard shortcuts

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