@@ -72,81 +72,26 @@ We'll need a new mark for our arguments. Let's call it
7272> (/mar/examples/ping/message.hoon).
7373
7474```
75−:: Up-ness monitor. Accepts atom url, 'on', or 'off'
7675::
77−:::: /hoon/up/examples/app
76+:::: /hoon/message/ping/examples/app
7877 ::
7978/? 314
80−|%
81−++ move {bone card}
82−++ card
83− $% {$hiss wire $~ $httr {$purl p/purl}}
84− {$wait wire @da}
85− ==
86−++ action
87− $% {$on $~} :: enable polling('on')
88− {$off $~} :: disable polling('off)
89− {$target p/cord} :: set poll target('http://...')
90− ==
91−--
92−|_ {hid/bowl on/_| in-progress/_| target/@t}
93−++ poke-atom
94− |= url-or-command/@t ^- (quip move +>)
95− =+ ^- act/action
96− ?: ?=($on url-or-command) [%on ~]
97− ?: ?=($off url-or-command) [%off ~]
98− [%target url-or-command]
99− ?- -.act
100− $target [~ +>.$(target p.act)]
101− $off [~ +>.$(on |)]
102− $on
103− :- ?: |(on in-progress) ~
104− [ost.hid %hiss /request ~ %httr %purl (need (epur target))]~
105− +>.$(on &, in-progress &)
106− ==
107−::
108−
109−:: ~& 'i get here'
110−:: ^- {(list move) _+>.$}
111−:: ?: =('off' url)
112−:: [~ +>.$(on |)]
113−:: ?: =('on' url)
114−:: :_ +>.$(on &, in-progress &)
115−:: ?: |(on in-progress)
116−:: ~
117−:: [ost.hid %them /request ~ (need (epur target)) %get ~ ~]~
118−:: [~ +>.$(target url)]
119−++ sigh-httr
120− |= {wir/wire code/@ud headers/mess body/(unit octs)}
121− ~& 'arrive here'
122− ^- {(list move) _+>.$}
123− ?: &((gte code 200) (lth code 300))
124− ~& [%all-is-well code]
125− :_ +>.$
126− [ost.hid %wait /timer (add ~s10 now.hid)]~
127− ~& [%we-have-a-problem code]
128− ~& [%headers headers]
129− ~& [%body body]
130− :_ +>.$
131− [ost.hid %wait /timer (add ~s10 now.hid)]~
132−++ wake-timer
133− |= {wir/wire $~} ^- (quip move +>)
134− ?: on
135− :_ +>.$
136− [ost.hid %hiss /request ~ %httr %purl (need (epur target))]~
137− [~ +>.$(in-progress |)]
138−::
139−++ prep ~& target _`. ::
79+|_ {to/@p message/@t}
80+++ grab
81+ |%
82+ ++ noun {@p @t}
83+ --
14084--
14185```
14286
14387The app can easily be modified to use this (`/app/examples/ping.hoon`):
14488
14589```
90+:: Allows one ship to ping another with a string of text
14691::
14792:::: /hoon/ping/examples/app
14893 ::
149−/? 151
94+/? 314
15095|%
15196 ++ move {bone term wire *}
15297--
@@ -172,8 +117,6 @@ The app can easily be modified to use this (`/app/examples/ping.hoon`):
172117::
173118++ coup |=(* `+>)
174119--
175−
176−
177120```
178121
179122Now we can run this with: