module

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WsUserID    = "sendID"
	OperationID = "operationID"
	PlatformID  = "platformID"
)
View Source
const (
	LogoutTips = "js sdk socket close"
	LogoutName = "Logout"
)
View Source
const (
	RESP_OP_TYPE      = "response"
	MQ_MSG_TYPE       = "mqMessage"
	HEART_CONFIG_TYPE = "heartConfig"
	CONN_CMD          = "connect"
	SUB_CMD           = "subscribe"
	UNSUB_CMD         = "unsubscribe"
	HEART_CMD         = "heart"
)
View Source
const DisconnectGCLimit = 100
View Source
const ProtocolError = "Protocol Error"

Variables

View Source
var ProgressStartTime int64

Functions

func CloseAgent

func CloseAgent(a gate.Agent)

CloseAgent is called when the WebSocket connection is closed. It performs cleanup actions for the agent.

func CloseStatusAgent

func CloseStatusAgent(a gate.Agent)

func DataRecv

func DataRecv(data interface{}, a gate.Agent)

DataRecv is called when new data is received on the WebSocket connection. It processes the incoming data through the actor.

func DataRecvStatus

func DataRecvStatus(data interface{}, a gate.Agent)

func NewAgent

func NewAgent(a gate.Agent)

NewAgent is called when a new WebSocket connection is established. It initializes agent-related data and checks the token validity.

func NewStatusAgent

func NewStatusAgent(a gate.Agent)

Types

type JsActorMap

type JsActorMap struct {
	sync.Mutex
	// contains filtered or unexported fields
}
var GJsActors *JsActorMap

type JsCore

type JsCore struct {
	RespMessagesChan chan *core_func.EventData
	// contains filtered or unexported fields
}

func NewJsCore

func NewJsCore(para *ParamStru, sessionId string) *JsCore

NewJsCore creates a new JsCore instance.

func (*JsCore) Destroy

func (core *JsCore) Destroy()

Destroy performs cleanup when the core is no longer needed.

func (*JsCore) RecvMsg

func (core *JsCore) RecvMsg() chan *core_func.EventData

RecvMsg returns the channel to receive messages.

func (*JsCore) SendMsg

func (core *JsCore) SendMsg(req *Req) error

SendMsg processes the incoming request and calls the corresponding method.

type JsInterface

type JsInterface interface {
	RecvMsg() chan interface{} //todo your sturct,error or response
	SendMsg(interface{}) error
	Destroy()
}

type MActor

type MActor interface {
	ProcessRecvMsg(interface{}) error
	Destroy()
	//
	ReleaseRes()
	// contains filtered or unexported methods
}

func NewMActor

func NewMActor(a gate.Agent, sessionId string, appParam *ParamStru) (MActor, error)

NewMActor creates a new actor instance.

func NewStatusActor

func NewStatusActor(a gate.Agent, sessionId string, appParam *ParamStru) (MActor, error)

type MActorIm

type MActorIm struct {
	SessionId string

	ReceivMsgChan chan interface{} //接收网络层数据通道
	// contains filtered or unexported fields
}

func (*MActorIm) Destroy

func (actor *MActorIm) Destroy()

func (*MActorIm) ProcessRecvMsg

func (actor *MActorIm) ProcessRecvMsg(msg interface{}) error

ProcessRecvMsg processes received messages and sends them to the ReceivMsgChan.

func (*MActorIm) ReleaseRes

func (actor *MActorIm) ReleaseRes()

type ParamStru

type ParamStru struct {
	UrlPath   string
	Token     string
	SessionId string
	UserId    int64
	GroupId   int64
	OrgId     int64
	OrgName   string
}

func (*ParamStru) GetOperationID

func (p *ParamStru) GetOperationID() string

GetOperationID parses the URL to get the OperationID parameter.

func (*ParamStru) GetPlatformID

func (p *ParamStru) GetPlatformID() string

GetPlatformID parses the URL to get the PlatformID parameter.

func (*ParamStru) GetUserID

func (p *ParamStru) GetUserID() string

GetUserID parses the URL to get the UserID parameter.

type Req

type Req struct {
	ReqFuncName string `json:"reqFuncName" `
	OperationID string `json:"operationID"`
	Data        string `json:"data"`
	UserID      string `json:"userID"`
	Batch       int    `json:"batchMsg"`
}

type RequestSt

type RequestSt struct {
	Cmd          string `json:"cmd"` // "subscribe" "unsubscribe" or "heart"
	RequestId    string `json:"requestId"`
	Topic        string `json:"topic"`
	Extra        string `json:"extra"`
	MsgTimeStamp int64  `json:"msgStartTime"`
	MsgSeqId     int64  `json:"msgSeqId"`
}

type ResReleaseStru

type ResReleaseStru struct {
	BackSign chan bool
}

type ResponseSt

type ResponseSt struct {
	Type         string   `json:"type"`    //"response" or "mqMessage" or "heartConfig"
	Cmd          string   `json:"cmd"`     //"connect" "subscribe" "unsubscribe"
	Success      bool     `json:"success"` //
	ErrMsg       string   `json:"errMsg"`
	UserId       []string `json:"userIds"`
	Duration     int64    `json:"duration"` // progress run time ,seconds
	RequestId    string   `json:"requestId"`
	Topic        string   `json:"topic"`
	Extra        string   `json:"extra"`
	MsgTimeStamp int64    `json:"msgTimeStamp"`
	MsgSeqId     int64    `json:"msgSeqId"`
	Data         string   `json:"data"`
	Rate         int64    `json:"rate"`
}

type StatusActorIm

type StatusActorIm struct {
	SessionId string

	ReceivMsgChan chan interface{} //接收网络层数据通道
	// contains filtered or unexported fields
}

func (*StatusActorIm) Destroy

func (actor *StatusActorIm) Destroy()

func (*StatusActorIm) ProcessRecvMsg

func (actor *StatusActorIm) ProcessRecvMsg(interface{}) error

func (*StatusActorIm) ReleaseRes

func (actor *StatusActorIm) ReleaseRes()

Jump to

Keyboard shortcuts

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