Runs on (chain ) with test GNOT only.

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.

  1. Set up this browser

    Turn on notifications, live updates, or both. Either one is enough for step 2.

    The address you will send the message from.

    Notifications

    This browser alerts you when your message arrives, even with the tab closed.

    Checking this browser…

    Live updates

    This page shows your message the moment it arrives, the way a dapp updates its own view. No permission prompt, and it works in any browser. While the page is open, it keeps a connection to the gnotif server and sends it your address.

    Live updates off

    See the code
    js · your page
    import { 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();
    });
  2. Send a message

    notification · this browser
    Echo · a few seconds after the call

    A send costs about 0.02 test GNOT from this address. Get test GNOT ↗

    Send with gnokey

    On a phone? Run the command on a computer that has your key; this browser gets the notification.

    sh · gnokey

    Set 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 ↗

    See the code
    gno · the echo realm
    func 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)
    }