1.0.0 • Published 3 years ago
dogomari-woof v1.0.0
dogomari
Dogomari: A Tribute to Winston. Woof Woof
how to
install
npm i dogomari-woof
object
import Dogomari from 'dogomari-woof'
const client = Dogomari('localhost:8800/box')
let msgs = []
client.onopen = async () => {
await client.publish('box', { name: 'something 🧰' }) // create
await client.publish('box', { name: 'still something 💾' }) // update
await client.unpublish('box') // delete
}
client.onmessage = async (msg) => { // read
msgs.push(msg)
if (msgs.length === 4) {
client.close()
console.log(msgs)
}
}
client.onerror = (err) => {
client.close()
}
list
import Dogomari from 'dogomari'
const client = Dogomari('localhost:8800/box/*')
let msgs = []
client.onopen = async () => {
const id = await client.publish('box/*', { name: 'something 🧰' }) // create
await client.publish('box/' + id, { name: 'still something 💾' }) // update
await client.publish('box/custom', { name: 'custom something 🧰' }) // create
await client.unpublish('box/*') // delete list
}
client.onmessage = async (msg) => { // read
msgs.push(msg)
if (msgs.length === 5) {
client.close()
console.log(msgs)
}
}
client.onerror = (err) => {
client.close()
}
1.0.0
3 years ago