Send yourself a notification.
One message, one on-chain event, one browser notification. Set up this browser, then send yourself a message through the echo realm, a small gno.land contract that emits each message as an event addressed to its sender.
-
Set up this browser
Turn on notifications, live updates, or both. Either one is enough for step 2.
See the code
js · your pageimport { Gnotif } from "gnotif"; const gnotif = new Gnotif({ network: "onyx", icon: "/icon.png" }); const [echo] = await gnotif.triggers(""); button.addEventListener("click", async () => { await gnotif.enable(); await gnotif.setOptins([{ trigger: echo.id, value: address }]); }); gnotif.on("notification", (n) => show(n)); live.addEventListener("change", async () => { if (!live.checked) return gnotif.disconnect(); await gnotif.setOptins([{ trigger: echo.id, value: address }]); await gnotif.connect(); }); -
Send a message
Send with gnokey
On a phone? Run the command on a computer that has your key; this browser gets the notification.
sh · gnokeySet your address in step 1 to continue.
Replace
<your key>with the name of your gnokey key for the address in step 1. The notification goes to whoever sends. No gnokey yet? Install it and make a key ↗Your messages
Nothing has arrived yet.
See the code
gno · the echo realmfunc init(cur realm) { me := cur.Sub(gnotif.Subpath) h := gnotif.Open(cross(me)) h.Set(cross(me), "echo", gnotif.Trigger{Event: "Echo", Param: "to", Title: "Echo", Body: "{msg}", Link: "/"}) } func Echo(cur realm, msg string) { chain.Emit("Echo", "to", cur.Previous().Address().String(), "msg", msg) }