|% :: +move: output effect :: +$ move [bone card] :: +card: output effect payload :: +$ card $% [%connect wire [(unit @t) (list @t)] %server] [%http-response =raw-http-response:light] == :: +$ state $: :: count: sends back the count value :: count=(map bone @ud) == -- :: utilities: :: |% :: ++ parse-request-line |= url=@t ^- [[(unit @ta) site=(list @t)] args=(list [key=@t value=@t])] (fall (rush url ;~(plug apat:de-purl:html yque:de-purl:html)) [[~ ~] ~]) :: +hello: :: ++ hello |= name=@t ^- octs %- as-octs:mimes:html %- crip %- en-xml:html ;html ;head ;title:"Hello, {<(trip name)>}" == ;body ;h1:"Hello, {<(trip name)>}" == == :: :: helper library that lets an app handle an EventSource. :: :: :: ++ event-source :: |_ m=(map session=@ud [last-id=@ud]) :: ++ abet m :: :: +start-session: called by app to start a session and send first event :: :: :: :: This creates a new session where we :: :: :: ++ start-session :: |= [session=@ud =bone data=wall] :: ^- [(list move) +>.$] :: :- :~ :* bone %http-response :: %start 200 :: :~ ['content-type' 'text/event-stream'] :: ['cache-control' 'no-cache'] :: == :: complete=%.n :: == == :: %_ +>.$ :: :: +reconnect-session: reconnect an old session to a new http pipe :: :: :: :: HTTP sessions can be killed :: :: :: ++ reconnect-session :: |= [session=@ud =bone last-seen=@ud] :: :: +confirm- :: :: :: ++ confirm- :: :: :: +end-session: called in response to an http pipe being closed :: :: :: :: :: ++ end-session :: :: ++ send-message :: :: |= [=bone ] :: -- ++ part1 ^- octs %- as-octs:mimes:html %- crip "