unsubscribe in poke.rkt

This commit is contained in:
Tony Garnock-Jones 2016-10-31 17:48:33 -04:00
parent 223033f664
commit 1dec02fd3d
1 changed files with 10 additions and 0 deletions

View File

@ -42,6 +42,8 @@
#:body (string->bytes/utf-8 (string-join strs)))]
[(list "sub" topic)
(spawn-subscriber topic)]
[(list "unsub" topic)
(unsubscribe-from topic)]
[(list)
(void)]
[_
@ -91,3 +93,11 @@
`((hub.callback . "http://localhost:7000/sink")
(hub.mode . "subscribe")
(hub.topic . ,topic))))))
(define (unsubscribe-from topic)
(request! 'post `("hub" ())
#:body (string->bytes/utf-8
(alist->form-urlencoded
`((hub.callback . "http://localhost:7000/sink")
(hub.mode . "unsubscribe")
(hub.topic . ,topic))))))