websocket

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var WsDebug *bool

Functions

func WsHandler

func WsHandler(c echo.Context) error

WsHandler 路由是 "/ws",即 ws://127.0.0.1:1234/api/ws

Types

type Message

type Message struct {
	Type       string `json:"type"`
	StatusCode int    `json:"status_code"` // 参考http状态码: https://zh.wikipedia.org/zh-hans/HTTP%E7%8A%B6%E6%80%81%E7%A0%81
	TabID      string `json:"tab_id"`      // 前端页面的 Tab ID
	Token      string `json:"Token"`       // 认证用
	Detail     string `json:"detail"`
	DataString string `json:"data_string"` // 附加的json字符串数据,服务器根据情况解析
}

Message 定义一个结构体来定义消息

type MessageWithClientID

type MessageWithClientID struct {
	Msg      Message
	ClientID string
}

Jump to

Keyboard shortcuts

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