为什么 donationalerts api socket returns 服务器错误?

why donationalerts api socket returns server error?

我只是想做捐赠系统但是它returns connect_error服务器错误

我看过一些指南,但没有帮助

我的代码:

const config = require("./config");

const socket = io.connect("wss://socket.donationalerts.ru:443");

socket.on("connect_error", (err) => {
    console.error(`connect_error ${err.message}`);
    //process.exit()
});
socket.on("disconnect", () => {
    console.log("socket disconnected");
});
socket.on("connect", (socket) => {
    const engine = socket.io.engine;
    console.log("app is starting")
    engine.on("disconnect", () => {
        console.log("Disconnected")
    })
})
socket.emit('add-user', { token: config.web.datoken, type: "minor" });
socket.on("donation", (donate) => {
    donate = JSON.parse(donate);
    let data = [
        `- Username: ${donate["username"]}`,
        `- Amount: ${donate["amount"]} ${donate["currency"]}`,
        `- Message: ${donate["message"]}`]
    console.log(`${data.join("\n")}`);
});

我需要将 transports: ["websocket"] 添加到连接参数。

const socket = io("wss://socket.donationalerts.ru:443"); // does not work

它是这样工作的:

const socket = io("wss://socket.donationalerts.ru:443", { transports: ["websocket"] }); // does work