UNPKG

uds-pubsub

Version:

Lightweight Unix Domain Socket pub/sub library for Node.js

9 lines (6 loc) 245 B
import { createClient } from '../src/index.js' const client = createClient({ name: 'weather-sensor' }) await client.connect() setInterval(() => { client.publish('weather/temperature', { temp: (20 + Math.random() * 10).toFixed(1) }) }, 5000)