From 8751ba26ebf7b7761b9e237f2bf3453623dd1018 Mon Sep 17 00:00:00 2001 From: polwex Date: Mon, 6 Oct 2025 10:13:39 +0700 Subject: added frontend WS connection for demonstration purposes --- app/lib/nostrill.hoon | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'app/lib/nostrill.hoon') diff --git a/app/lib/nostrill.hoon b/app/lib/nostrill.hoon index 41caff2..933dc7f 100644 --- a/app/lib/nostrill.hoon +++ b/app/lib/nostrill.hoon @@ -1,5 +1,6 @@ /- post=trill-post, nsur=nostr, sur=nostrill, gate=trill-gate, comms=nostrill-comms -/+ trill=trill-post, nostr-keys, sr=sortug, jsonlib=json-nostrill +/+ trill=trill-post, nostr-keys, sr=sortug, jsonlib=json-nostrill, + ws=websockets |% :: ++ default-state |= =bowl:gall ^- state:sur @@ -28,12 +29,28 @@ ~& >> total=total-received $(l t.l) +++ ui-ws-res |= [wid=@ msg=@t] + + =/ resmsg (cat 3 msg (cat 3 msg msg)) + =/ octs (as-octs:mimes:html resmsg) + =/ res-event=websocket-event:eyre [%message 1 `octs] + (give-ws-payload:ws wid res-event) :: ++ cards |_ =bowl:gall ++ shim-binding ^- card:agent:gall [%pass /binding %arvo %e %connect [~ /nostr-shim] dap.bowl] + + ++ relay-binding ^- card:agent:gall + [%pass /binding %arvo %e %connect [~ /nostrill] dap.bowl] + ++ ui-binding ^- card:agent:gall + [%pass /binding %arvo %e %connect [~ /nostrill-ui] dap.bowl] + ++ bindings + :~ shim-binding + relay-binding + ui-binding + == ++ update-ui |= =fact:ui:sur ^- card:agent:gall =/ jon (fact:en:jsonlib fact) [%give %fact ~[/ui] %json !>(jon)] -- cgit v1.2.3