socketio

package
v0.0.0-...-c38fcd0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WrapH

Types

type ConnectParam

type ConnectParam struct {
	ID     string          `form:"id" validate:"required"` //机器码
	ConnID string          `form:"-"`
	Type   string          `form:"type" validate:"oneof=web pad device wx"`
	Name   string          `form:"name"`
	UserID string          `form:"userID"`
	Conn   gosocketio.Conn `form:"-" json:"-"`
}

type RoomDescribe

type RoomDescribe struct {
	//in:body
	//房间名
	RoomName string `json:"roomName"`
	//房间数量
	Number int `json:"number"`
	//设备名与socketio ID map
	DeviceDescribe map[string]string `json:"deviceDescribe"` //
}

type RoomDescribeListResponse

type RoomDescribeListResponse []RoomDescribe

type SocketioServer

type SocketioServer struct {
	Socketio *gosocketio.Server

	FrontLoginInfoMap map[int64]map[string][]*ConnectParam //前端登录信息
	// contains filtered or unexported fields
}

func GetSocketServer

func GetSocketServer() *SocketioServer

func (*SocketioServer) Debug

func (server *SocketioServer) Debug(data any)

func (*SocketioServer) Error

func (server *SocketioServer) Error(data any)

func (*SocketioServer) Info

func (server *SocketioServer) Info(data any)

func (*SocketioServer) ListAllSocket

func (socket *SocketioServer) ListAllSocket() (map[string]string, map[int64]map[string][]*ConnectParam)

func (*SocketioServer) ListRooms

func (socket *SocketioServer) ListRooms() []RoomDescribe

ListRooms 返回所有的房间以及房间里的成员

func (*SocketioServer) NewID

func (socket *SocketioServer) NewID() string

func (*SocketioServer) Run

func (socket *SocketioServer) Run(httpServer *http.Server)

func (*SocketioServer) SendEventToDevice

func (socket *SocketioServer) SendEventToDevice(deviceIDList []string, event string, message interface{}) (successList []string, failList []string, err error)

func (*SocketioServer) SendEventToUser

func (socket *SocketioServer) SendEventToUser(userIDList []int64, deviceType string, event string, message interface{}) error

func (*SocketioServer) SendNoticeToUser

func (socket *SocketioServer) SendNoticeToUser(userID int64, message interface{})

func (*SocketioServer) Warn

func (server *SocketioServer) Warn(data any)

type UserType

type UserType string
var (
	PAD    UserType = "pad"
	DEVICE UserType = "device"
	WEB    UserType = "web"
	WX     UserType = "wx" //微信小程序
	ALL    UserType = "all"
)

Jump to

Keyboard shortcuts

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