Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/chenxilol/gohub
/ functions
Functions
347 in github.com/chenxilol/gohub
⨍
Functions
347
◇
Types & classes
58
↓ 1 callers
Method
Authenticate
Authenticate 验证令牌并返回令牌声明
pkg/auth/auth.go:43
↓ 1 callers
Function
ClientConnected
便捷方法,用于快速记录指标 ClientConnected 记录客户端连接
internal/metrics/metrics.go:168
↓ 1 callers
Function
ClientDisconnected
ClientDisconnected 记录客户端断开连接
internal/metrics/metrics.go:175
↓ 1 callers
Method
CreateRoom
以下是房间相关操作的便捷方法 CreateRoom 创建一个新房间
pkg/hub/hub.go:413
↓ 1 callers
Method
DeleteRoom
DeleteRoom 删除一个房间
pkg/hub/hub.go:418
↓ 1 callers
Method
GetAuthClaims
GetAuthClaims 获取客户端的认证声明
pkg/hub/client.go:197
↓ 1 callers
Method
GetClient
(id string)
pkg/hub/hub.go:500
↓ 1 callers
Function
GetDispatcher
()
internal/dispatcher/dispatcher.go:32
↓ 1 callers
Method
GetMembers
GetMembers 获取房间内所有客户端ID
pkg/hub/room.go:129
↓ 1 callers
Function
GetRegistry
GetRegistry 获取Prometheus注册表
internal/metrics/metrics.go:153
↓ 1 callers
Method
GetRoomCount
()
pkg/sdk/sdk.go:54
↓ 1 callers
Method
IsAuthenticated
IsAuthenticated 检查客户端是否已认证
pkg/hub/client.go:202
↓ 1 callers
Method
IsAuthenticated
认证相关
pkg/sdk/sdk.go:61
↓ 1 callers
Method
LeaveRoom
LeaveRoom 客户端离开房间
pkg/hub/hub.go:445
↓ 1 callers
Function
New
(cfg Config)
pkg/bus/redis/redis.go:121
↓ 1 callers
Function
NewDispatcher
()
internal/dispatcher/dispatcher.go:39
↓ 1 callers
Function
NewJWTService
(secretKey, issuer string)
pkg/auth/jwt.go:25
↓ 1 callers
Function
NewMessageDeduplicator
NewMessageDeduplicator 消息去重器
pkg/hub/dedup.go:43
↓ 1 callers
Function
NewMetrics
NewMetrics 创建新的Metrics实例
internal/metrics/metrics.go:50
↓ 1 callers
Function
NewRoom
NewRoom 创建一个新房间
pkg/hub/room.go:47
↓ 1 callers
Function
NewRoomManager
NewRoomManager 创建一个新的房间管理器
pkg/hub/room.go:150
↓ 1 callers
Function
NewSDK
NewSDK 创建新的SDK实例
pkg/sdk/sdk.go:84
↓ 1 callers
Method
ObservePublishLatency
ObservePublishLatency 观察发布延迟
pkg/bus/nats/metrics.go:107
↓ 1 callers
Method
ObserveSubscribeLatency
ObserveSubscribeLatency 观察订阅延迟
pkg/bus/redis/metrics.go:71
↓ 1 callers
Method
On
事件订阅
pkg/sdk/sdk.go:66
↓ 1 callers
Function
ParseLogLevel
ParseLogLevel parses a string log level to slog.Level
configs/config.go:138
↓ 1 callers
Method
ReadMessage
()
internal/websocket/conn_iface.go:6
↓ 1 callers
Function
RecordAuthSuccess
RecordAuthSuccess 记录认证成功
internal/metrics/metrics.go:238
↓ 1 callers
Function
RecordError
RecordError 记录错误
internal/metrics/metrics.go:232
↓ 1 callers
Function
RecordLatency
RecordLatency 记录延迟
internal/metrics/metrics.go:226
↓ 1 callers
Function
RegisterHandlers
RegisterHandlers 注册所有消息处理函数到分发器
internal/handlers/handlers.go:26
↓ 1 callers
Method
RegisterMessageHandler
消息分发注册
pkg/sdk/sdk.go:70
↓ 1 callers
Method
RemoveClient
RemoveClient 从房间移除客户端
pkg/hub/room.go:74
↓ 1 callers
Function
RoomCreated
RoomCreated 记录创建房间
internal/metrics/metrics.go:196
↓ 1 callers
Function
RoomDeleted
RoomDeleted 记录删除房间
internal/metrics/metrics.go:202
↓ 1 callers
Function
RoomJoined
RoomJoined 记录加入房间
internal/metrics/metrics.go:208
↓ 1 callers
Function
RoomLeft
RoomLeft 记录离开房间
internal/metrics/metrics.go:214
↓ 1 callers
Method
SetReadLimit
(int64)
internal/websocket/conn_iface.go:9
↓ 1 callers
Method
SetWriteDeadline
(time.Time)
internal/websocket/conn_iface.go:11
↓ 1 callers
Function
SetupConfigHotReload
SetupConfigHotReload sets up hot reload for the configuration file
configs/config.go:122
↓ 1 callers
Method
UpdateAckPending
UpdateAckPending 更新等待确认的消息数量
pkg/bus/nats/metrics.go:102
↓ 1 callers
Function
ZeroFields
func main() { // 定义命令行参数 port := flag.Int("port", 8080, "WebSocket服务端口") id := flag.String("id", "client", "客户端ID,用于在输出中区分") flag.Parse() // 构建
test_client.go:81
↓ 1 callers
Method
authenticateWebSocket
authenticateWebSocket 对WebSocket连接进行认证。
server/server.go:237
↓ 1 callers
Function
buildConfig
(opts *Options)
server/server.go:368
↓ 1 callers
Method
cleanExpired
cleanExpired 清理过期的消息缓存
pkg/hub/dedup.go:84
↓ 1 callers
Function
createMessageBus
(cluster configs.Cluster)
server/server.go:405
↓ 1 callers
Function
defaultOptions
()
server/server.go:323
↓ 1 callers
Function
extractToken
(r *http.Request)
server/server.go:418
↓ 1 callers
Function
fillDefaults
(opts *Options)
server/server.go:338
↓ 1 callers
Function
generateClientID
(r *http.Request, claims *auth.TokenClaims)
server/server.go:434
↓ 1 callers
Function
generateNodeID
()
pkg/hub/hub.go:75
↓ 1 callers
Function
getRandomPort
获取随机可用端口
pkg/bus/nats/core_test.go:60
↓ 1 callers
Function
getUsername
(claims *auth.TokenClaims)
server/server.go:450
↓ 1 callers
Method
initComponents
initComponents 初始化内部组件
server/server.go:197
↓ 1 callers
Function
natsExample
natsExample 演示使用NATS的集群模式
examples/cluster/main.go:29
↓ 1 callers
Function
prepareJsonPayload
prepareJsonPayload 准备消息的JSON载荷
pkg/hub/hub.go:366
↓ 1 callers
Method
processBroadcastMessages
processBroadcastMessages 处理从给定的广播通道接收消息,直到上下文完成或通道关闭。
pkg/hub/hub.go:122
↓ 1 callers
Method
processBusMessage
(data []byte)
pkg/hub/hub.go:137
↓ 1 callers
Method
processRoomMessage
processRoomMessage 处理从bus接收的房间消息
pkg/hub/room.go:227
↓ 1 callers
Method
processRoomMessagesLoop
processRoomMessagesLoop 处理房间消息循环
pkg/hub/room.go:212
↓ 1 callers
Method
processUnicastMessages
processUnicastMessages 处理从给定的单播通道接收消息,直到上下文完成、通道关闭或客户端断开连接。
pkg/hub/hub.go:213
↓ 1 callers
Method
readLoop
()
pkg/hub/client.go:100
↓ 1 callers
Method
setupBusSubscriptions
(ctx context.Context)
pkg/hub/hub.go:83
↓ 1 callers
Method
setupClient
setupClient 创建、配置并注册新客户端。
server/server.go:266
↓ 1 callers
Method
setupJetStream
setupJetStream 设置JetStream
pkg/bus/nats/nats.go:141
↓ 1 callers
Function
setupLogging
(level string)
server/server.go:399
↓ 1 callers
Method
setupRoomSubscriptions
setupRoomSubscriptions 设置房间消息订阅
pkg/hub/room.go:169
↓ 1 callers
Method
subscribeClientUnicast
subscribeClientUnicast 为客户端订阅单播消息
pkg/hub/hub.go:248
↓ 1 callers
Method
subscribeJetStream
subscribeJetStream 使用JetStream订阅
pkg/bus/nats/core_pubsub.go:264
↓ 1 callers
Method
subscribeJetStreamWithTimestamp
subscribeJetStreamWithTimestamp 使用JetStream订阅并解析时间戳
pkg/bus/nats/core_pubsub.go:608
↓ 1 callers
Method
subscribeRoutine
subscribeRoutine 订阅Redis频道
pkg/bus/redis/subscribe.go:13
↓ 1 callers
Method
subscribeRoutineWithTimestamp
subscribeRoutineWithTimestamp 订阅Redis频道并解析时间戳
pkg/bus/redis/subscribe.go:70
↓ 1 callers
Method
subscribeStandard
subscribeStandard 使用标准NATS订阅
pkg/bus/nats/core_pubsub.go:214
↓ 1 callers
Method
subscribeStandardWithTimestamp
subscribeStandardWithTimestamp 使用标准NATS订阅并解析时间戳
pkg/bus/nats/core_pubsub.go:546
↓ 1 callers
Method
triggerEvent
触发事件(内部使用)
pkg/sdk/sdk.go:239
↓ 1 callers
Method
writeLoop
()
pkg/hub/client.go:125
Method
Authenticate
Authenticate 实现Authenticator接口,验证JWT令牌
pkg/auth/jwt.go:65
Method
BroadcastAll
(message []byte)
pkg/sdk/sdk.go:46
Method
BroadcastAll
(message []byte)
pkg/sdk/sdk.go:119
Method
BroadcastToRoom
BroadcastToRoom 向房间内所有客户端广播消息
pkg/hub/room.go:333
Method
BroadcastToRoom
(roomID string, message []byte, excludeClientID string)
pkg/sdk/sdk.go:165
Method
CheckClientPermission
(clientID string, permission auth.Permission)
pkg/sdk/sdk.go:63
Method
CheckClientPermission
(clientID string, permission auth.Permission)
pkg/sdk/sdk.go:206
Method
CheckPermission
CheckPermission 实现Authorizer接口,检查权限
pkg/auth/jwt.go:125
Method
CheckPermission
CheckPermission 检查令牌是否有特定权限
pkg/auth/auth.go:52
Method
ClientInRoom
ClientInRoom 检查客户端是否在指定房间内
pkg/hub/room.go:369
Method
Close
Close 关闭房间管理器
pkg/hub/room.go:391
Method
Close
()
pkg/hub/integration_test.go:100
Method
Close
()
pkg/hub/hub_test.go:54
Method
Close
()
pkg/hub/hub_test.go:181
Method
Close
()
pkg/hub/client.go:42
Method
Close
Close 实现SDK接口的关闭方法
pkg/sdk/sdk.go:259
Method
Close
Close 实现MessageBus.Close,标记为已关闭
pkg/bus/noop/noop.go:90
Method
Close
Close 实现MessageBus.Close,关闭Redis连接
pkg/bus/redis/redis.go:179
Method
Close
Close 实现MessageBus.Close,关闭NATS连接
pkg/bus/nats/nats.go:267
Method
Close
()
internal/integration/mocks.go:52
Method
Close
()
internal/websocket/conn_iface.go:12
Method
CreateRoom
CreateRoom 创建一个新房间
pkg/hub/room.go:265
Method
CreateRoom
实现SDK接口的房间管理方法
pkg/sdk/sdk.go:136
Method
DecodeAndRoute
DecodeAndRoute 实现了 MessageDispatcher 接口
pkg/hub/hub_test.go:198
← previous
next →
101–200 of 347, ranked by callers