node-steam hangs up
SzymonLisowiec opened this issue · comments
Szymon Lisowiec commented
My script and your node_modules/steam/example.js
not working. Library don't receiving any messages from Steam.
Евгений Мнацаканов commented
Server list is outdated. Here is my solution to fix it (ty scholtzm)
async function loadServerList() {
let response = await $.httpGetJson("https://api.steampowered.com/ISteamDirectory/GetCMList/v1/?format=json&cellid=0");
Steam.servers = [];
for (const server of response.response.serverlist) {
let _server = server.split(":");
Steam.servers.push({ "host": _server[0], "port": _server[1] });
}
}
xc4t commented
where exactly should I put this code?
I have no idea
xc4t commented
can someone please help :p
Szymon Lisowiec commented
const Steam = require('steam');
const Request = require('request-promise-native');
(async _ => {
await loadServerList();
// Your script
})();
async function loadServerList() {
let response = await Request('https://api.steampowered.com/ISteamDirectory/GetCMList/v1/?format=json&cellid=0');
response = JSON.parse(response);
Steam.servers = [];
for (const server of response.response.serverlist) {
let _server = server.split(":");
Steam.servers.push({ "host": _server[0], "port": _server[1] });
}
}
xc4t commented
thanks!