2013-03-29 03:00:29 +00:00
|
|
|
#lang marketplace
|
|
|
|
|
2013-06-07 15:35:50 +00:00
|
|
|
(observe-publishers (tcp-channel ? (tcp-listener 5999) ?)
|
2013-06-03 18:57:42 +00:00
|
|
|
(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
|
2013-06-08 01:01:55 +00:00
|
|
|
(publisher (tcp-channel to from ?))
|
2013-06-07 21:46:20 +00:00
|
|
|
(subscriber (tcp-channel from to ?)
|
2013-06-03 18:57:42 +00:00
|
|
|
(on-absence (quit))
|
|
|
|
(on-message
|
|
|
|
[(tcp-channel _ _ data)
|
|
|
|
(send-message (tcp-channel to from data))]))))
|