【发布时间】:2020-10-09 14:45:32
【问题描述】:
我有一个通过 websockets 进行聊天的功能项目,它已经在运行,现在我需要通过 JWT 实现身份验证。这是请求的流程
- 客户端连接到
ws://localhost:port/chatting - 客户端订阅自己的收件箱,以便接收来自其他客户端的消息:
/user/{userId}/queue/chatting - 客户端可以在 /app/message 中通过在正文中指定向其他用户发送消息:
{ 'message': msg, 'from': "userId", 'to': "recipientId" },系统会将他们重定向到/user/{recipientId}/queue/chatting
我想确保:
- 用户必须进行身份验证才能握手
- 用户必须是“userId”才能订阅 /user/"userId"/queue/chatting,这样其他用户就无法访问它。
- 用户必须是“userId”才能向正文中
from中具有“userId”的另一个用户发送消息
【问题讨论】:
标签: spring websocket jwt chat stomp