Skip to content

Commit

Permalink
stomp: minor updates
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjbq7 committed May 9, 2024
1 parent 60f4712 commit 641cf5c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 1 addition & 5 deletions extra/stomp/cli/cli.factor
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,8 @@ INITIALIZED-SYMBOL: stomp-port [ 61613 ]
CONSTANT: stomp-mailbox $[ <mailbox> ]

: put-frame ( frame -- )
[ "put: " write dup . flush ] with-global
stomp-mailbox mailbox-put ;

: get-frame ( frame -- )
[ "\nget: " write . flush ] with-global ;

CONSTANT: COMMANDS {
T{ command
{ name "abort" }
Expand Down Expand Up @@ -77,7 +73,7 @@ M: stomp-command-loop run-command-loop
[
stomp-host get resolve-host [ ipv4? ] filter random
stomp-port get with-port utf8 [
stomp-mailbox [ nl get-frame ] stomp-loop
stomp-mailbox [ [ nl . flush ] with-global ] stomp-loop
] with-client
] in-thread call-next-method ;

Expand Down
4 changes: 3 additions & 1 deletion extra/stomp/stomp.factor
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ INITIALIZED-SYMBOL: stomp-version [ "1.1" ]
{ "1.2" [ "\\" "\\\\" replace "\n" "\\n" replace ":" "\\c" replace "\r" "\\r" replace ] }
} case ;

! XXX: unescape-header

: read-command ( -- command )
readln ;

Expand Down Expand Up @@ -94,7 +96,7 @@ INITIALIZED-SYMBOL: stomp-ack-mode [ "auto" ]
: write-frame ( frame -- )
receipt-id stomp-debug
[ command>> print ]
[ headers>> [ ":" swap [ write ] tri@ nl ] assoc-each nl ]
[ headers>> [ escape-header ":" swap [ write ] tri@ nl ] assoc-each nl ]
[ body>> [ write ] when* 0 write1 ] tri flush ;

SYMBOL: stomp-heartbeat
Expand Down

0 comments on commit 641cf5c

Please sign in to comment.