summaryrefslogtreecommitdiff
path: root/app/ted/ws.hoon
diff options
context:
space:
mode:
Diffstat (limited to 'app/ted/ws.hoon')
-rw-r--r--app/ted/ws.hoon20
1 files changed, 20 insertions, 0 deletions
diff --git a/app/ted/ws.hoon b/app/ted/ws.hoon
new file mode 100644
index 0000000..b8dd583
--- /dev/null
+++ b/app/ted/ws.hoon
@@ -0,0 +1,20 @@
+/- spider
+/+ strandio
+=, strand=strand:spider
+^- thread:spider
+|= arg=vase
+=/ m (strand ,vase)
+^- form:m
+=/ url=@t (need !<((unit @t) arg))
+;< =bowl:spider bind:m get-bowl:strandio
+=/ desk q.byk.bowl
+=/ =task:iris [%websocket-connect desk url]
+=/ =card:agent:gall [%pass /ws-req %arvo %i task]
+;< ~ bind:m (send-raw-card:strandio card)
+;< res=(pair wire sign-arvo) bind:m take-sign-arvo:strandio
+?. ?=([%iris %websocket-handshake id=@ud url=@t] q.res)
+ (strand-fail:strand %bad-sign ~)
+~& ws-handshake=[id.q.res url.q.res]
+:: ?: ?=([%iris %websocket-response id=@ud e=websocket-event:eyre] q.res)
+=/ data=@t 'done'
+(pure:m !>(data))