https://github.com/herover/steam-condenser-js
A port of steam-condenser for Node.js!
https://github.com/herover/steam-condenser-js
javascript srcds steam steam-condenser typescript
Last synced: about 1 month ago
JSON representation
A port of steam-condenser for Node.js!
- Host: GitHub
- URL: https://github.com/herover/steam-condenser-js
- Owner: Herover
- License: bsd-3-clause
- Created: 2016-09-12T23:58:16.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T08:25:23.000Z (over 3 years ago)
- Last Synced: 2025-03-15T06:35:26.104Z (about 1 year ago)
- Topics: javascript, srcds, steam, steam-condenser, typescript
- Language: TypeScript
- Homepage:
- Size: 1.13 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Steam Condenser
Work in progress implementation of steam-condenser in Typescript/node.js.
## Usage
The library is implemented in Typescript but works fine with JavaScript.
```javascript
const { SourceServer, MasterServer } = require('steam-condenser');
async function main() {
const server = new SourceServer(ip);
try {
// Set up connection
await server.initialize();
const info = await server.getServerInfo();
console.log(info);
const rules = await server.getRules();
console.log(rules);
const players = await server.getPlayers();
console.log(players);
// We need to authorize with rcon before executing commands
await server.rconAuth(password);
const stats = await server.rconExec("stats");
console.log(stats);
}
catch (e) {
console.error(e);
}
finally {
// Remember to disconnect
await server.disconnect();
}
const ms = SourceServer.GetMaster();
try {
// Get first page of server ip's running de_dust
const servers = await ms.getServers(MasterServer.REGION_ALL,
"\\map\\de_dust");
console.log(servers);
}
catch(error) {
console.error(error);
}
finally {
await ms.disconnect();
}
}
main();
```
## Status and limitations
The module currently only supports what is described in above example. Full
parity with koraktors Steam Condenser is the final goal.
When using the current library it's important to realize that it's ported code
expecting network communication to be blocking, but it uses non-blocking
functions. This means you must not call more than one function that
communicates over the same socket (`getRules` and `getInfo`, or multiple rcon
commands).
Ex.
`await Promise.all([server.rconExec("stats"), server.rconExec("sv_gravity")])`
might not work, but opening two connections or running them in serial will
work.