1.0.7 • Published 4 years ago
haxball-server-nodejs v1.0.7
Haxball-Server-Nodejs
Haxball-Server-Nodejs is a tool to run Haxball server in native nodejs (without puppeteer).
We rewrited headless.min.js from the browser to nodejs (the first package that offers native nodejs support).
Install
npm i haxball-server-nodejs
Usage
- required: generate headless token
const HBInit = require('haxball-server-nodejs');
(async () => {
const { room, roomLink } = await HBInit({
token: 'token', // Insert token here (required!)
roomName: 'My room',
maxPlayers: 16,
noPlayer: true, // Remove host player (recommended!),
});
console.log(roomLink);
}()
- Rest of the development continues the same with Haxball API
Dependencies
- @mapboxnode-pre-gyp - Helps installation of wrtc c++ files - can be deleted after installation : npm uninstall @mapbox/node-pre-gyp
- wrtc - WebRTC implementation in nodejs
- ws - WebSocket connection
- JSON5 - JSON helper
- @peculiar/webcrypto - webcrypto in nodejs
Changelog
V1.0.5 - 2021/10/15
- HBInit promise rejected if token is invalid
- published to npm
V1.0.6 - 2021/10/21
- minor changes
V1.0.7 - 2021/10/24
- Auth fixed (thanks to @mertushka). dependency @peculiar/webcrypto added to support webcrypto in node versions <15. in newer node version (>15) we will use node built in webcrypto
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.