marketplace-2014/examples/echo-paper.rkt

15 lines
421 B
Racket
Raw Permalink Normal View History

2013-03-29 03:00:29 +00:00
#lang marketplace
(observe-publishers (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
(publisher (tcp-channel to from ?))
(subscriber (tcp-channel from to ?)
(on-absence (quit))
(on-message
[(tcp-channel _ _ data)
(send-message (tcp-channel to from data))]))))