-
Notifications
You must be signed in to change notification settings - Fork 527
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@OnMessage不支持@PathVariable String类型数据接收 #211
Comments
OnMessage是用来接收websocket消息的,websocket消息不是http请求,不会有url上的参数 |
websocket消息是建立连接之后的信息传输,连接地址的信息也是可以获取到的。 |
|
没有太大必要性,毕竟这个是OnOpen的时候就确定的。 |
倒不是要框架去存一份,你写的是满足链接地址上取值的,但是这必须是其他类型不能是String。 |
连接只有在客户端发起http请求的时候才有,后面发消息的时候不存在连接,只有msg。 |
在握手完毕建立连接后,http相关请求行,请求头都应该抛弃掉,成为一个纯粹的websocket通道 |
要是纯粹是这样也没有问题,open的时候可以把信息存在session中,发送信息的时候在session中获取。 |
onMessage是被框架回调的,支持其他类型你如何使用呢 |
onMessage(Session session, String message, @PathVariable Integer xxx,@PathVariable Integer xx) |
放到链接后面拼装的参数里: "?a=b&c=d", 就可以通过这个对象拿到 |
我试试 |
我也遇到这个问题了 onClose onEvent 啥的填上 @RequestParam String uid 都是ws链接过来的key |
@OnMessage方法的String参数都会被赋值成发送的信息,@PathVariable会失效
The text was updated successfully, but these errors were encountered: