vms
vmsq
npm i vmsq
vms

vmsq

query valve's master servers

by Raine Virta

2.1.0 (see all)License:ISCTypeScript:Not Found
npm i vmsq
Readme

vmsq npm version

a library for querying valve's master servers with node.js

$ npm install vmsq

usage

vmsq(masterServer :: String, region :: Number, filters? :: Object) → ReadableStream

  • masterServer: The master server to query, e.g. hl2master.steampowered.com:27011
  • region: Region to query, e.g. 0x03 or vmsq.EUROPE
  • filters: Optional object that contains filters sent with the query

Returns a ReadableStream emitting each server as a string one by one.

example

const vmsq = require('vmsq')

const stream = vmsq('hl2master.steampowered.com:27011', vmsq.EUROPE, {
  gamedir: 'cstrike',
  map: 'de_nuke',
  empty: 1
})

const servers = []

stream.on('error', (err) => {
  console.error(err)
})

stream.on('data', (ip) => {
  console.log(ip)
  servers.push(ip)
})

stream.on('end', () => {
  console.log(`got ${servers.length} servers`)
})

output

88.241.39.16:27015
178.150.208.1:40000
...
got 24 servers

more on filters

\nor[x] A special filter, specifies that servers matching any of the following [x] conditions should not be returned \nand[x] A special filter, specifies that servers matching all of the following [x] conditions should not be returned

nor and nand filters are handled in a slightly different way and take an object:

vmsq('hl2master.steampowered.com:27011', vmsq.EUROPE, {
  gamedir: 'cstrike',

  // don't return servers that match all of the conditions
  nand: {
    map: 'de_nuke'
  }
})

notes

Downloads/wk

6

GitHub Stars

10

LAST COMMIT

6yrs ago

MAINTAINERS

1

CONTRIBUTORS

0

OPEN ISSUES

0

OPEN PRs

0
VersionTagPublished
2.1.0
latest
6yrs ago
No alternatives found
No tutorials found
Add a tutorial

Rate & Review

100
No reviews found
Be the first to rate