marketplace-2014/marketplace/examples/echo-paper.rkt

14 lines
389 B
Racket
Raw Normal View History

2013-03-29 03:00:29 +00:00
#lang marketplace
(subscribe-to-topic (tcp-channel ? (tcp-listener 5999) ?)
(match-conversation (tcp-channel from to _)
(on-presence (spawn (echoer from to)))))
2013-03-29 03:00:29 +00:00
(define (echoer from to)
(transition stateless
(subscribe-to-topic (tcp-channel from to ?)
(on-absence (quit))
(on-message
[(tcp-channel _ _ data)
(send-message (tcp-channel to from data))]))))