This package contains a way to search for games hosted locally for the SkeldJS client, meant to be installed separately with npm install --save @skeldjs/lan or yarn add @skeldjs/lan. It is also one package of a bigger project, skeldjs.
The LAN discovery class is separate from the skeldjs client class, giving you a class to listen for whenever a game is found.
constlanDiscovery = newLanDiscovery;lanDiscovery.begin(); // start listening for games hosted locallylanDiscovery.on("discovery.foundgame", foundGame=> { // emitted whenever a game is foundconsole.log("Found game: " + foundGame.name + " @ " + foundGame.ip + ":" + foundGame.port);});
You could also wait for the first game to pop up:
constlanDiscovery = newLanDiscovery;lanDiscovery.begin();constfoundGame = awaitlanDiscovery.wait("discovery.foundgame");lanDiscovery.end(); // make sure to end the lan discovery when you've finished with it
A good integration with @skeldjs/client, for example, would look something along the lines of:
@skeldjs/lan
This package contains a way to search for games hosted locally for the SkeldJS client, meant to be installed separately with
npm install --save @skeldjs/lan
oryarn add @skeldjs/lan
. It is also one package of a bigger project, skeldjs.You can view auto-updating documentation for this package hosted at github pages at https://skeld.js.org/modules/lan.html
Basic Usage
The LAN discovery class is separate from the skeldjs client class, giving you a class to listen for whenever a game is found.
You could also wait for the first game to pop up:
A good integration with
@skeldjs/client
, for example, would look something along the lines of: