This package provides a promise-based Node.js module for programmatically interacting with Steam's Master Server Query Protocol and Game Server Queries. It enables developers to fetch lists of active game servers from a Steam master server, supporting extensive filtering by region and various server properties (e.g., game directory, map, player count, appid). Additionally, it fully supports querying individual game servers for detailed information via A2S_INFO (server name, map, players), A2S_PLAYER (player list with scores and duration), and A2S_RULES (server-specific rules and values). The current stable version is 1.1.3, with recent releases focusing on improved socket stability, enhanced retry mechanisms for queries, and options to mitigate rate limiting during master server lookups. It ships with comprehensive TypeScript type definitions, ensuring robust usage in modern JavaScript and TypeScript environments. Its primary differentiator is its complete implementation of both Master and Game Server Query protocols with a resilient, promise-based API.
npm install steam-server-queryVerified import paths — ran on the pinned version, not inferred.
Demonstrates querying a Steam master server to find Team Fortress 2 servers, then querying the first found game server for its detailed information and player list.
Upgrade to `steam-server-query@1.1.1` or newer to ensure proper socket cleanup.
When calling `queryMasterServer`, utilize the `maxHosts` parameter to cap the number of returned servers, e.g., `queryMasterServer(..., maxHosts: 50)`. Consider adding delays between successive master server queries if fetching large lists.
Upgrade to `steam-server-query@1.1.3` or newer. If on an older version, manually implement retry logic when calling `queryGameServerPlayer`.
Always ensure the `gameServer` string includes both the host (IP or domain) and the port, e.g., `'192.168.1.100:27015'` or `'mygameserver.com:27015'`.
Increase the `timeout` parameter for the query function. Verify the `gameServer` address and port are correct and that the server is online and accessible from your network. Check firewall rules.
For CommonJS, use `const { queryMasterServer, REGIONS } = require('steam-server-query');`. Ensure your project's `package.json` is not explicitly set to `"type": "module"` if you intend to use `require`.This issue was largely resolved in `steam-server-query@1.1.1`. Ensure you are on version `1.1.1` or higher. If the problem persists, it may indicate another application is using the port, or a very rapid succession of queries without allowing the OS to release the port.
No dependency data recorded yet.