summaryrefslogtreecommitdiff
path: root/app/lib/nostr/req.hoon
diff options
context:
space:
mode:
authorpolwex <polwex@sortug.com>2025-10-06 07:58:25 +0700
committerpolwex <polwex@sortug.com>2025-10-06 07:58:25 +0700
commit410cc8e8949c6ab0677daebbad10cea5f1b9686c (patch)
tree2946ca36a81d5642fb8cd53a2268ecca0e89b59e /app/lib/nostr/req.hoon
parentc4b392a179048f936c062f5ffccc2bc25627e500 (diff)
added websockets server logic to nostrill
Diffstat (limited to 'app/lib/nostr/req.hoon')
-rw-r--r--app/lib/nostr/req.hoon19
1 files changed, 19 insertions, 0 deletions
diff --git a/app/lib/nostr/req.hoon b/app/lib/nostr/req.hoon
new file mode 100644
index 0000000..ce566bc
--- /dev/null
+++ b/app/lib/nostr/req.hoon
@@ -0,0 +1,19 @@
+/- sur=nostr
+/+ js=json-nostr, sr=sortug,
+ lib=nostr,
+ server,
+ ws=websockets
+|%
+++ parse-client-msg
+ |= jon=json ^- (unit client-msg:nsur)
+ (client-msg:de:js jon)
+++ ok-client-event |= [=event:nsur ok=? msg=@t]
+ ^- relay-msg
+ [%ok id.event ok msg]
+++ ws-response
+ |= msg=relay-msg:sur ^- (list card:agent:gall)
+ =/ jon (relay-msg:en:js msg)
+ =/ octs (json-to-octs:server jon)
+ =/ res-event=websocket-event:eyre [%message 1 `octs]
+ (give-ws-payload:ws wid res-event)
+--