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

15 lines
386 B
Racket
Raw Normal View History

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