Skip to content
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

请问server端如何获取到客户端的连接URL呢? #33

Open
ernestmeng opened this issue Mar 21, 2019 · 5 comments
Open

请问server端如何获取到客户端的连接URL呢? #33

ernestmeng opened this issue Mar 21, 2019 · 5 comments

Comments

@ernestmeng
Copy link

请问server端如何获取到客户端的连接URL呢?

@YeautyYE
Copy link
Owner

是什么场景需要获取到URL?

1.WebSocket启动时,客户端能连接到服务端的URL已经是确定的,不需要获取
2.如果一定要获取,可以在OnOpen时headers.get("host")获取host, 而path是写死在当前类的@ServerEndpoint中的

@ernestmeng
Copy link
Author

谢谢,已经解决了。我们是一个服务器,接不同视频流,有每个摄像头ip等参数,客户端连接过来也是需要有对应的ip才能推送相应的摄像头识别结果。另外问一下,这个是否支持作为client?现在只看到有ServerEndpoint注解,但是没有ClientEndpoint,我们当然是想使用同一种方式,不想一个应用中一会是基于netty的,一会是基于Tomcat的

@YeautyYE
Copy link
Owner

目前没有,如果需要的话,可以邮件给你提供netty 写的websocket client demo

@ernestmeng
Copy link
Author

brave_wgj0611@163.com

@ernestmeng
Copy link
Author

非常感谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants