// Public API of the shared/ws segment — the app-wide realtime channel. // // 传输层是 **KenEvent(RocketMQ 事件 → Socket.IO, `/socket.io`)**:浏览器用 // 会话 cookie(`gitdata_session`)或 CONNECT 包的 `auth.token` 完成鉴权, // 客户端只发 `subscribe`/`unsubscribe`,服务端推 `event`/`resync` 信封 // `{topic, tag, properties, body}`,详情一律通过 REST 回拉。 // // 旧的 `GET /ws/v1`(`app/im` 网关,裸 WebSocket + `gitdata.jwt.*` 子协议) // 已随 KenApi 重构删除,相关实现(含一次性握手 JWT)一并移除。 // // 连接属于整个会话而不是某个聊天窗口,所以放在 shared 而不是 chat feature 内。 // 房间意图按引用计数:第一个观看者进入时订阅,最后一个离开时退订。 // // Typical usage: // const ws = new ChatWsClient() // ws.onFrame(frame => { if (frame.type === 'event') ... }) // ws.onIssue(issue => ...) // 订阅被拒、鉴权失败、断流补齐 // ws.onStatus(status => ...) // 含终态 'auth_required' // ws.start() // ws.subscribe(roomId) // 订阅房间;历史用 REST 拉 export { ChatWsClient, type ChatWsClientOptions, type WsClientIssue } from './client' export { ChatRealtimeHub, getRealtimeHub, resetRealtimeHub } from './hub' export { asServerFrame, type ClientFrame, classifyWsError, isNotificationUserEvent, isSubscribeError, parseServerFrame, type RoomEvent, roomEventSeq, type ServerFrame, type UserEvent, WS_BYE_MESSAGES, WS_CLIENT_OPS, WS_ERROR_MESSAGES, WS_RESYNC_REASONS, WS_ROOM_EVENT_KINDS, WS_SERVER_DEFAULTS, WS_SERVER_FRAME_TYPES, WS_USER_EVENT_KINDS, type WsByeMessage, type WsErrorMessage, type WsMessage, type WsNotification, type WsPingFrame, type WsReactionSummary, type WsResyncFrame, type WsResyncReason, type WsServerErrorKind, type WsStatus, type WsSubscribeFrame, type WsTypingFrame, type WsTypingIndicator, type WsUnsubscribeFrame, } from './protocol' export { sendTypingSignal, useRoomWatch, useTypingIndicators, useWsFrames, useWsIssues, useWsStatus, useWsUserEvents, useWsUserId, } from './react' export { TypingRegistry, type WsTypingEvent } from './typing'