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

请问一个关于websocket路由的问题 #440

Open
ttAllen1 opened this issue Apr 17, 2023 · 1 comment
Open

请问一个关于websocket路由的问题 #440

ttAllen1 opened this issue Apr 17, 2023 · 1 comment
Assignees
Labels
analyzing Analyzing this issue

Comments

@ttAllen1
Copy link

作者在

 App\Services\WebSocketService 的示例代码中
onOpen() 中有这样一行注释:Then the /ws route in Laravel needs to add the middleware like Authenticate

我有几个疑问,希望大佬们帮忙理清下思路:

  1. 这里的路由/ws 按照作者的意思是走了laravel的路由,并且经过了相关中间件的处理,拿到当前用户相关的一些数据。这给我的感觉是一次http请求,服务器响应后应该会断开连接。但是,反向代理nginx中也匹配了一个/ws的location。我就不太理解这两处的/ws的具体应用。
  2. 客户端在申请建立websocket连接之前,确实会先发送一次http请求,但是这个http请求应该不会走到laravel的路由中。反向代理服务器直接响应101

再次感谢大佬们,能帮忙解除心中的疑惑谢谢!!!万分感谢

@ttAllen1 ttAllen1 added the analyzing Analyzing this issue label Apr 17, 2023
@uptonyuan
Copy link

uptonyuan commented Apr 17, 2023 via email

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

No branches or pull requests

3 participants