此问题仅限于Firefox和Edge,而Chrome可以正常运行。考虑到我的最终目标是进行音频/视频聊天,而不是文本聊天。
尝试连接时,API会引发相同的错误:
{ code: 422, status: "error", detail: "Status.CONNFAIL - The connection attempt failed", message: "Unprocessable Entity" }
consultations:389:29
Firefox在日志中显示此消息:
Firefox can’t establish a connection to the server at wss://chat.quickblox.com:5291/.
Edge显示以下内容:
XML5632: Only one root element is allowed.
SCRIPT12030: SCRIPT12030: WebSocket Error: Network Error 12030, The connection with the server was terminated abnormally
正在遵循以下语法:
QB.init(applicationSessionToken, appId, {})
QB.chat.connect({
userId: QB.chat.helpers.getUserJid( '{{ $userQuickBlox->quickBloxId }}', 75452),
password: '{{ $userQuickBlox->password }}',
}, function(err, roster) {
if (err) {
console.log(err);
}
});
编辑1:
Fiddler对Firefox和Edge发布相同的输出:
GET / HTTP/1.1
Origin: https://cmed-web.vantagedigital.net
Host: chat.quickblox.com:5291
Connection: Upgrade
Upgrade: websocket
Cache-Control: no-cache
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.18362
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: 5xM/G6qmjyskDdYfizDhWA==
Sec-WebSocket-Protocol: xmpp
DNT: 1
虽然铬的外观有些不同:
GET / HTTP/1.1
Origin: https://cmed-web.vantagedigital.net
Host: chat.quickblox.com:5291
Connection: Upgrade
Cache-Control: no-cache
Upgrade: websocket
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: rnICPLwETXQWapHTwCheFg==
Sec-WebSocket-Protocol: xmpp
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Pragma: no-cache
编辑2:
经过一番摆弄之后,Firefox现在会引发以下错误,而不是连接错误:
XML Parsing Error: junk after document element
QuickBlox SDK生成XML以与其API进行通信。但是,由于这是第三方SDK,因此我真的无法摆弄它从缩小来源发出的请求。
该应用程序是使用PHP 7.3 / Laravel 5.8和jQuery 3构建的。
我要求解决此问题,并在可能的情况下要求解释为什么它们在这些浏览器中的行为不同。谢谢!