Appearance
jet
Mermaid 图表
mermaid
graph TD
A[启动HTTP服务] --> B
A[启动HTTP服务] --> API
B[启动websocket] --> |新ws连接| C{握手时验证jwt}
C -->|失败| D[HTTP断开]
C -->|条件2| E[处理2]
D --> END[结束]
E --> F[通过jwt的ns加入ns的lobby]
F --> G[等待新消息]
G --> |JOIN| EV_JOIN[加入房间]
G --> |LEAVE| EV_LEAVE[离开房间]
G --> |CLOSE| EV_CLOSED[连接关闭]
G --> |MESSAGE| EV_MESSAGE[其他消息]
EV_JOIN --> | 已经在其他非lobby | EV_LEAVE_EXISTED[离开非loobby] --> notify_to_http --> G
EV_JOIN --> | 未其他非lobby | EV_JOIN_SUCCESS[加入新房间] --> notify_to_http --> G
EV_LEAVE_EXISTED --> | JOIN | EV_JOIN[加入房间] --> G
EV_LEAVE --> |LEVAE_ROOM| LEVAE_ROOM[离开非loobby] --> notify_to_http --> G
EV_LEAVE --> |LEVAE_LOBBY| LEVAE_LOBBY[离开loobby] --> notify_to_http --> G
EV_MESSAGE --> notify_to_http --> G
EV_CLOSED --> |DISCONNECTED| LEVAE_ALL_ROOMS[连接断开,从所有房间离开] --> notify_to_http --> END
API --> POST[验证jwt]
POST --> |direct| SEND_TO_CONNECTION --> CLOSE
POST --> |room| SEND_TO_ROOM --> CLOSE