Tweak to presence notification
This commit is contained in:
parent
59469d68f8
commit
5fca0d7aac
|
@ -20,6 +20,7 @@
|
|||
(match-define (topic _ (tcp-channel connection-id _ _) _) t)
|
||||
(define-values (cin cout in-topic out-topic) (tcp-accept t))
|
||||
(transition 'no-state
|
||||
(at-meta-level (cout (term->bytes `(you-are ,connection-id))))
|
||||
(at-meta-level (cin (tcp-mode 'lines)))
|
||||
(at-meta-level (cin (tcp-credit 1)))
|
||||
(at-meta-level (role/anon out-topic))
|
||||
|
@ -32,9 +33,8 @@
|
|||
(role/anon (topic-subscriber `(,(wild) says ,(wild)))
|
||||
#:topic t
|
||||
#:on-presence (match t [(topic _ `(,who ,_ ,_) _)
|
||||
(at-meta-level (cout (term->bytes (if (equal? who connection-id)
|
||||
`(you-are ,connection-id)
|
||||
`(,who arrived)))))])
|
||||
(when (not (equal? who connection-id))
|
||||
(at-meta-level (cout (term->bytes `(,who arrived)))))])
|
||||
#:on-absence (match t [(topic _ `(,who ,_ ,_) _)
|
||||
(when (not (equal? who connection-id))
|
||||
(at-meta-level (cout (term->bytes `(,who departed)))))])
|
||||
|
|
Loading…
Reference in New Issue