Closed troublezzb closed 2 years ago
phpsocket.io v1.1.13 socket.io-client v2.4.0 (Chrome 98.0.4758.102 64bit)
io(window.g.socketUrl, {transports: ['websocket', 'polling']})
The following error occurred in the browser:
WebSocket connection to 'ws://192.168.255.1:4052/socket.io/?EIO=3&transport=websocket' failed:
My Thoughts: I think this judgment is not handled well. src/Engine/Engine.php (commit 25243e320bf6b43f11b96974d1a54241dcd07bce)
if ($transport === 'websocket' && empty($sid)) { return call_user_func($fn, self::ERROR_UNKNOWN_TRANSPORT, false, $req, $res); }
Interim Solution: @jichangfeng You can try:
io(window.g.socketUrl)
const socket = io("https://example.com", { transports: ["websocket", "polling"] // use WebSocket first, if available });
socket.on("connect_error", () => { // revert to classic upgrade socket.io.opts.transports = ["polling", "websocket"]; });
phpsocket.io v1.1.14 removed the judgment. Please upgrade. Sorry for the inconvenience.
It works. Thanks for your prompt reply.
Solved. Thanks。
phpsocket.io v1.1.13 socket.io-client v2.4.0 (Chrome 98.0.4758.102 64bit)
The following error occurred in the browser:
My Thoughts: I think this judgment is not handled well. src/Engine/Engine.php (commit 25243e320bf6b43f11b96974d1a54241dcd07bce)
Interim Solution: @jichangfeng You can try:
socket.on("connect_error", () => { // revert to classic upgrade socket.io.opts.transports = ["polling", "websocket"]; });