MCPcopy Create free account

hub / github.com/chenxilol/gohub / functions

Functions347 in github.com/chenxilol/gohub

↓ 93 callersMethodError
Error 实现error接口
pkg/hub/error.go:56
↓ 33 callersMethodClose
()
pkg/bus/bus.go:29
↓ 32 callersMethodPublish
Publish 发布消息到指定主题
pkg/bus/bus.go:18
↓ 22 callersMethodGetID
()
pkg/hub/client.go:187
↓ 19 callersMethodSubscribe
Subscribe 订阅指定主题,返回接收channel
pkg/bus/bus.go:21
↓ 16 callersFunctionNewClient
(ctx context.Context, id string, conn WSConn, cfg Config, onClose func(string), dispatcher MessageDispatcher)
pkg/hub/client.go:65
↓ 15 callersFunctionDefault
Default 获取默认指标实例
internal/metrics/metrics.go:158
↓ 15 callersMethodMarshal
()
pkg/bus/message.go:20
↓ 15 callersMethodRegister
Register 注册一个客户端到Hub
pkg/hub/hub.go:181
↓ 14 callersFunctionNewHub
(messageBus bus.MessageBus, cfg Config)
pkg/hub/hub.go:51
↓ 14 callersFunctionstartNatsServer
测试辅助函数,启动NATS服务器
pkg/bus/nats/core_test.go:14
↓ 13 callersMethodClose
Close 关闭Hub及其所有客户端连接
pkg/hub/hub.go:484
↓ 13 callersFunctionNew
New 创建一个新的NatsBus实例
pkg/bus/nats/nats.go:61
↓ 13 callersMethodPush
Push 发送消息到特定客户端
pkg/hub/hub.go:303
↓ 12 callersMethodSend
Send 发送消息到客户端
pkg/hub/client.go:86
↓ 11 callersFunctionDefaultConfig
DefaultConfig 返回默认配置
pkg/bus/nats/nats.go:32
↓ 11 callersMethodEncode
Encode 将消息编码为JSON
pkg/hub/message.go:36
↓ 10 callersFunctionDefaultConfig
()
pkg/hub/client.go:54
↓ 10 callersFunctionNewError
NewError 创建新的错误响应
pkg/hub/error.go:46
↓ 9 callersMethodGetWrittenMessages
()
pkg/hub/hub_test.go:59
↓ 9 callersFunctionnewMockDispatcher
()
pkg/hub/hub_test.go:206
↓ 8 callersMethodClose
关闭SDK
pkg/sdk/sdk.go:73
↓ 8 callersMethodGetClientCount
GetClientCount 获取当前连接的客户端数量
pkg/hub/hub.go:401
↓ 8 callersMethodIncSubscribeErrors
IncSubscribeErrors 增加订阅错误计数
pkg/bus/nats/metrics.go:87
↓ 8 callersMethodUnsubscribe
Unsubscribe 取消订阅主题
pkg/bus/bus.go:27
↓ 7 callersMethodRegister
消息解码并路由
pkg/hub/dispatcher_interface.go:10
↓ 6 callersMethodGetWrittenMessages
()
internal/integration/mocks.go:57
↓ 6 callersFunctionNewMessage
NewMessage 创建一个新的消息
pkg/hub/message.go:21
↓ 6 callersFunctionNewServer
NewServer 创建一个新的GoHub服务器
server/server.go:85
↓ 6 callersMethodResetWrittenMessages
()
internal/integration/mocks.go:63
↓ 6 callersFunctionSendError
SendError 向客户端发送错误响应
pkg/hub/error.go:69
↓ 6 callersMethodStart
Start 启动服务器
server/server.go:147
↓ 6 callersMethodString
String 返回消息ID的字符串表示
pkg/hub/dedup.go:19
↓ 5 callersMethodGetClient
(clientID string)
pkg/sdk/sdk.go:44
↓ 5 callersMethodGetRoom
GetRoom 获取一个房间
pkg/hub/room.go:293
↓ 5 callersMethodHasClient
HasClient 检查客户端是否在房间内
pkg/hub/room.go:121
↓ 5 callersMethodIncAckErrors
IncAckErrors 增加确认错误计数
pkg/bus/nats/metrics.go:92
↓ 5 callersFunctionNew
New 创建一个新的NoopBus实例
pkg/bus/noop/noop.go:18
↓ 5 callersMethodRegisterHandler
RegisterHandler 注册自定义消息处理器
server/server.go:120
↓ 5 callersMethodShutdown
(ctx context.Context)
server/server.go:178
↓ 5 callersFunctionnewMockDispatcher
newMockDispatcher 创建一个新的 mock dispatcher 实例
internal/integration/mocks.go:98
↓ 5 callersFunctionsetupTestRedis
setupTestRedis 创建一个miniredis服务器实例用于测试
pkg/bus/redis/redis_test.go:14
↓ 5 callersMethodshutdown
()
pkg/hub/client.go:155
↓ 4 callersMethodBroadcast
Broadcast 向所有连接的客户端广播消息
pkg/hub/hub.go:324
↓ 4 callersMethodBroadcastToRoom
(roomID string, message []byte, excludeClientID string)
pkg/sdk/sdk.go:57
↓ 4 callersFunctionFormatUnicastTopic
(clientID string)
pkg/hub/hub.go:42
↓ 4 callersMethodHandleFunc
HandleFunc 添加自定义HTTP处理函数
server/server.go:137
↓ 4 callersMethodHasPermission
HasPermission 检查客户端是否具有特定权限
pkg/hub/client.go:207
↓ 4 callersMethodIncPublishErrors
IncPublishErrors 增加发布错误计数
pkg/bus/nats/metrics.go:82
↓ 4 callersMethodMarkProcessed
MarkProcessed 标记消息已处理
pkg/hub/dedup.go:74
↓ 4 callersMethodformatKey
(topic string)
pkg/bus/redis/redis.go:174
↓ 4 callersMethodlocalBroadcast
localBroadcast 执行本地广播,向所有本地客户端发送消息
pkg/hub/hub.go:388
↓ 3 callersMethodGetRoom
(id string)
pkg/sdk/sdk.go:52
↓ 3 callersMethodIncSubscribeErrors
IncSubscribeErrors 增加订阅错误计数
pkg/bus/redis/metrics.go:60
↓ 3 callersMethodJoinRoom
(roomID string, clientID string)
pkg/sdk/sdk.go:55
↓ 3 callersMethodLatency
()
pkg/bus/message.go:33
↓ 3 callersMethodLeaveRoom
(roomID string, clientID string)
pkg/sdk/sdk.go:56
↓ 3 callersMethodListRooms
()
pkg/sdk/sdk.go:53
↓ 3 callersFunctionMapErrorToCode
映射内部错误到标准错误码
pkg/hub/error.go:84
↓ 3 callersFunctionNewDefaultConfig
NewDefaultConfig creates a new Config with default values
configs/config.go:49
↓ 3 callersFunctionRetryWithBackoff
RetryWithBackoff 尝试执行 'operation'。如果失败,它会以指数退避的方式重试 'maxRetries' 次。 operationName 用于日志记录。 initialBackoff 是初始的退避时间。 maxBackoff 是最大的退避时间。 operation 是要执行
internal/utils/retry.go:15
↓ 3 callersMethodSDK
SDK 获取GoHub SDK实例
server/server.go:142
↓ 3 callersMethodShutdown
()
pkg/hub/client.go:166
↓ 3 callersFunctionUnmarshalMessage
(data []byte)
pkg/bus/message.go:24
↓ 3 callersMethodWriteMessage
(int, []byte)
internal/websocket/conn_iface.go:7
↓ 2 callersMethodBroadcast
Broadcast 向房间内所有客户端广播消息
pkg/hub/room.go:88
↓ 2 callersMethodBroadcastToRoom
BroadcastToRoom 向房间内所有客户端广播消息
pkg/hub/hub.go:450
↓ 2 callersMethodClose
()
pkg/hub/cluster_test.go:134
↓ 2 callersMethodCreateRoom
房间管理
pkg/sdk/sdk.go:50
↓ 2 callersMethodDecodeAndRoute
(ctx context.Context, client *Client, data []byte)
pkg/hub/dispatcher_interface.go:9
↓ 2 callersFunctionDefaultConfig
()
pkg/bus/redis/redis.go:62
↓ 2 callersMethodDeleteRoom
(id string)
pkg/sdk/sdk.go:51
↓ 2 callersFunctionFormatRoomTopic
FormatRoomTopic 格式化房间主题名称
pkg/hub/room.go:33
↓ 2 callersMethodGenerateID
GenerateID 生成新的消息ID
pkg/hub/dedup.go:58
↓ 2 callersMethodGetClientCount
连接管理
pkg/sdk/sdk.go:43
↓ 2 callersMethodGetRoom
GetRoom 获取一个房间
pkg/hub/hub.go:423
↓ 2 callersMethodHandle
Handle 添加自定义HTTP路由
server/server.go:132
↓ 2 callersFunctionHasPermission
HasPermission 是一个辅助函数,用于检查给定的 TokenClaims 是否包含指定的任一权限。 如果用户拥有 PermAdminSystem 权限,则视为拥有所有权限。
pkg/auth/auth.go:57
↓ 2 callersMethodIncPublishErrors
IncPublishErrors 增加发布错误计数
pkg/bus/redis/metrics.go:55
↓ 2 callersMethodIncReconnects
IncReconnects 增加重连计数
pkg/bus/redis/metrics.go:65
↓ 2 callersMethodIsDuplicate
IsDuplicate 检查消息是否重复
pkg/hub/dedup.go:68
↓ 2 callersMethodJoinRoom
JoinRoom 将客户端加入房间
pkg/hub/hub.go:433
↓ 2 callersFunctionMessageSent
MessageSent 记录发送消息
internal/metrics/metrics.go:190
↓ 2 callersFunctionNewClusterMockBus
()
pkg/hub/cluster_test.go:23
↓ 2 callersFunctionNewEnhancedMockBus
(id string)
pkg/hub/integration_test.go:27
↓ 2 callersFunctionNewMessage
(data []byte)
pkg/bus/message.go:13
↓ 2 callersMethodObserveSubscribeLatency
ObserveSubscribeLatency 观察订阅延迟
pkg/bus/nats/metrics.go:112
↓ 2 callersMethodOn
On 注册事件处理器
server/server.go:125
↓ 2 callersFunctionRecordAuthFailure
RecordAuthFailure 记录认证失败
internal/metrics/metrics.go:244
↓ 2 callersFunctionRecordCriticalError
RecordCriticalError 记录严重错误
internal/metrics/metrics.go:250
↓ 2 callersFunctionRoomMessageSent
RoomMessageSent 记录房间消息
internal/metrics/metrics.go:220
↓ 2 callersMethodSetAuthClaims
SetAuthClaims 设置客户端的认证声明
pkg/hub/client.go:192
↓ 2 callersMethodSetReadDeadline
(time.Time)
internal/websocket/conn_iface.go:10
↓ 2 callersMethodTriggerEvent
TriggerEvent 触发事件(外部可用)
pkg/sdk/sdk.go:254
↓ 2 callersMethodUnregister
Unregister 从Hub移除客户端
pkg/hub/hub.go:293
↓ 2 callersMethodUnsubscribe
Unsubscribe 实现MessageBus.Unsubscribe,取消NATS订阅
pkg/bus/nats/core_pubsub.go:438
↓ 2 callersFunctioncreateJetStreamTestConfig
createJetStreamTestConfig 创建用于测试的JetStream配置
pkg/bus/nats/jetstream_test.go:355
↓ 2 callersMethodmonitorPendingMessages
monitorPendingMessages 定期更新等待确认的消息数量
pkg/bus/nats/core_pubsub.go:186
↓ 2 callersFunctionrunServer
runServer 运行服务器的通用逻辑
examples/cluster/main.go:74
↓ 1 callersMethodAddClient
AddClient 添加客户端到房间
pkg/hub/room.go:57
next →1–100 of 347, ranked by callers