@@ -72,81 +72,26 @@ We'll need a new mark for our arguments. Let's call it
72> (/mar/examples/ping/message.hoon).
72> (/mar/examples/ping/message.hoon).
75−:: Up-ness monitor. Accepts atom url, 'on', or 'off'
77−:::: /hoon/up/examples/app
76+:::: /hoon/message/ping/examples/app
81−++ move {bone card}
82+ ++ noun {@p @t}
83− $% {$hiss wire $~ $httr {$purl p/purl}}
87− $% {$on $~} :: enable polling('on')
88− {$off $~} :: disable polling('off)
89− {$target p/cord} :: set poll target('http://...')
92−|_ {hid/bowl on/_| in-progress/_| target/@t}
94− |= url-or-command/@t ^- (quip move +>)
96− ?: ?=($on url-or-command) [%on ~]
97− ?: ?=($off url-or-command) [%off ~]
98− [%target url-or-command]
100− $target [~ +>.$(target p.act)]
103− :- ?: |(on in-progress) ~
104− [ost.hid %hiss /request ~ %httr %purl (need (epur target))]~
105− +>.$(on &, in-progress &)
110−:: ^- {(list move) _+>.$}
114−:: :_ +>.$(on &, in-progress &)
115−:: ?: |(on in-progress)
117−:: [ost.hid %them /request ~ (need (epur target)) %get ~ ~]~
118−:: [~ +>.$(target url)]
120− |= {wir/wire code/@ud headers/mess body/(unit octs)}
122− ^- {(list move) _+>.$}
123− ?: &((gte code 200) (lth code 300))
124− ~& [%all-is-well code]
126− [ost.hid %wait /timer (add ~s10 now.hid)]~
127− ~& [%we-have-a-problem code]
128− ~& [%headers headers]
131− [ost.hid %wait /timer (add ~s10 now.hid)]~
133− |= {wir/wire $~} ^- (quip move +>)
136− [ost.hid %hiss /request ~ %httr %purl (need (epur target))]~
137− [~ +>.$(in-progress |)]
139−++ prep ~& target _`. ::
143The app can easily be modified to use this (`/app/examples/ping.hoon`):
87The app can easily be modified to use this (`/app/examples/ping.hoon`):
90+:: Allows one ship to ping another with a string of text
147:::: /hoon/ping/examples/app
92:::: /hoon/ping/examples/app
151 ++ move {bone term wire *}
96 ++ move {bone term wire *}
@@ -172,8 +117,6 @@ The app can easily be modified to use this (`/app/examples/ping.hoon`):
173++ coup |=(* `+>)
118++ coup |=(* `+>)
179Now we can run this with:
122Now we can run this with: