Handbook
Glossary
stomp-loop ( mailbox quot: ( frame -- ) -- )
Vocabulary
stomp
Inputs
mailbox
an
object
quot
a
quotation
with stack effect
( frame -- )
Outputs
None
Definition
USING:
accessors
assocs
calendar
concurrency.mailboxes
continuations
io
io.timeouts
kernel
math
math.parser
namespaces
splitting
threads
;
IN:
stomp
::
stomp-loop
( mailbox quot: ( frame -- ) -- )
stomp-heartbeat
get
parse-heartbeat
:>
( cx cy ) 10
seconds
timeouts
stomp-connect-and-wait
adjust-stomp-version
f
timeouts
headers>>
"heart-beat"
of
"0,0"
or
","
split1
[
string>number
]
bi@
:>
( sx sy ) cx sy
heartbeat-interval
:>
client-heartbeat-interval cy sx
heartbeat-interval
:>
server-heartbeat-interval server-heartbeat-interval
[
2
*
milliseconds
timeouts
]
unless-zero
mailbox client-heartbeat-interval
[
f
]
when-zero
stomp-version
get
"1.2"
=
"\n"
"\r\n"
?
[
[
mailbox-get-timeout
[
write-frame
t
]
[
stomp-disconnect
write-frame
f
]
if*
]
2curry
]
dip
[
[
drop
]
]
dip
[
write
flush
t
]
curry
compose
[
recover
]
2curry
"stomp writer"
spawn-server
drop
quot
read-frames
;