summaryrefslogtreecommitdiff
path: root/app/lib/websockets.hoon
diff options
context:
space:
mode:
Diffstat (limited to 'app/lib/websockets.hoon')
-rw-r--r--app/lib/websockets.hoon14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/lib/websockets.hoon b/app/lib/websockets.hoon
new file mode 100644
index 0000000..9faea96
--- /dev/null
+++ b/app/lib/websockets.hoon
@@ -0,0 +1,14 @@
+|%
+ ++ give-ws-payload
+ |= [wid=@ event=websocket-event:eyre]
+ ^- (list card:agent:gall)
+ =/ =cage
+ [%websocket-response !>([wid event])]
+ =/ wsid (scot %ud wid)
+ :~ [%give %fact ~[/websocket-server/[wsid]] cage]
+ ==
+ ++ accept-handshake |= wid=@
+ =/ response [%accept ~]
+ (give-ws-payload wid response)
+
+--