bagman
TypeScript icon, indicating that this package has built-in type declarations

1.5.0 • Public • Published

Bagman JS

This is the official JS/TS client for Bagman

Getting Started

npm install bagman
import { Bagman } from "bagman";

// initialise client
const bagman = new Bagman({ 
    url: "<bagman-server-url>",
    apiKey: "<api-key>"
});

// subscribe to a channel
const channel = await bagman.subscribe("<channel>");
// listen to a event in a channel
// await to make sure listen is sucessful
await channel.listen("explosion", (data) => {
    // do something with the data
});

// emit some data to the channel
// await to make sure emit is successful
await channel.emit("greetings", {
    "hello": "world"
});

Package Sidebar

Install

npm i bagman

Weekly Downloads

7

Version

1.5.0

License

MIT

Unpacked Size

316 kB

Total Files

41

Last publish

Collaborators

  • p313avee