Skip to content

xdream77/oldb.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Small MQTT wrapper for OpenLigaDB

Description

This package connects to the mqtt channel of openLigaDB and automatically receives live updates. It provides you to specify topics you're interested in and only emits those data to your system.

Installation

The package is hosted on JSR and not npm, so follow the instructions there for your runtime.

Examples

Connect to OLDB with current mqtt data and receive all updates

import { OLDB, type OldbData } from "@wgd/oldb";

const oldbClient = new OLDB()

oldbClient.on('oldb:update', (msg: OldbData) => {
    // You receive ALL updates from OLDB
    // your code here
})

Sign to leagues

import { OLDB, type OldbData } from "@wgd/oldb";

const oldbClient = new OLDB({
     leagueShorts: ['bl1', 'bl2']
})

oldbClient.on('oldb:update', (msg: OldbData) => {
    // You only receive updates for the OLDB.leagueShortcut you choose
    // your code here
})

If mqtt data changes you also can pass in connection infos, which will overwrite the standard.

import { OLDB } from "@wgd/oldb";

const oldbClient = new OLDB({
     baseUrl: settings.baseUrl,
     topic: settings.topic,
     port: settings.port
})

Logging you also can pass in your logger if you wish, defaults to console. It does not log very much though.

const oldbClient = new OLDB({
     logger: myPrivatePinoLogger
})

About

JS Wrapper for OLDB live data

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published