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

关于信道服务器,https://ws.qcloud.com #4

Open
xzshinan opened this issue Aug 10, 2017 · 6 comments
Open

关于信道服务器,https://ws.qcloud.com #4

xzshinan opened this issue Aug 10, 2017 · 6 comments

Comments

@xzshinan
Copy link

建立连接的时候,业务服务器 请求 信道服务器 https://ws.qcloud.com/get/wsurl

疑问1:信道服务器返回的值 其实是 数组。
TunnelService.php 第101行 进行了json_decode 操作。

疑问2:信道服务器返回的值中没有 signature。

@kavil
Copy link

kavil commented Oct 29, 2017

+1

@jas0ncn
Copy link
Contributor

jas0ncn commented Oct 29, 2017

  1. 你说的这个是因为 $packet 之前是 json,解析了之后才是数组。你可以看一下具体的代码执行顺序。

  2. 不知道是什么的 signature?

@kavil
Copy link

kavil commented Oct 29, 2017

[2017-10-29 14:50:23][DEBUG] POST https://ws.qcloud.com/get/wsurl => [200] {
"[请求]": {
"data": "{"receiveUrl":"https://vox-api.cn/tunnel","protocolType":"wss"}",
"tcId": "ffff613b6c46f44bfd6a7f04e58396ca",
"tcKey": "abc-",
"signature": "4f24a372798e8fad5c0ef8583412ac9ac3fd7735"
},
"[响应]": {
"code": 0,
"message": "OK",
"data": {
"tunnelId": "02ca30d0-740a-4b02-9d74-6f5d7f78f3ec",
"connectUrl": "wss://ws.qcloud.com/ws/test?tunnelId=02ca30d0-740a-4b02-9d74-6f5d7f78f3ec"
}
},
"[耗时]": "73ms"
}

这是日志,没有返回signature

@jas0ncn
Copy link
Contributor

jas0ncn commented Oct 30, 2017

这个签名只是用来校验数据的,不是给信道用的。直接连接信道即可。

@kavil
Copy link

kavil commented Oct 30, 2017

image
但是sdk里TunnelService.php82行拿不到会报错[捂脸]

@jas0ncn
Copy link
Contributor

jas0ncn commented Oct 30, 2017

不是的,这个地方是可以拿到的。。

整个流程是这样的:

-------            -------------            -----------
| 用户 |    ->    | 业务服务器 |    ->    | 信道服务 |
|         |    <-    |                    |    <-    |                |
------             -------------             -----------

你截图的那个信道服务器不是我们小程序专用的,报错是因为你的 sdk.config 配置错误了。。要把 https://ws.qcloud.com/ 修改为 https://tunnul.ws.qcloud.la/

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

3 participants