Publish and subscribe

demo.ednSelected server rule
(on "demo.sensors.*"
  (-> payload-float
      (round 1)
      (squelch)
      (publish! (subject-append "stable"))))
View full server config

Live output

Round readings and suppress repeats

Ready

Round to one decimal place, then publish only when that rounded value changes.

Subscribe first, then send the sample readings in order.

These are the homepage examples running on a real server, with subjects prefixed by demo.. State is shared per subject, so other visitors can affect averages and threshold crossings. Choose a different name in place of temp across the subject fields to use a separate stream. Use two browser windows or your phone to see multiple clients updating.

Back to the examples · Use the NATS CLI

monoblok (:4222), all demo messages:

NATS server (:4223), receives messages exported by monoblok: