33 lines
1.0 KiB
Racket
33 lines
1.0 KiB
Racket
|
#lang imperative-syndicate
|
||
|
|
||
|
(provide (all-from-out "protocol.rkt")
|
||
|
(all-from-out "client.rkt")
|
||
|
(all-from-out "server.rkt"))
|
||
|
|
||
|
(require "protocol.rkt")
|
||
|
(require/activate "client.rkt")
|
||
|
(require/activate "server.rkt")
|
||
|
|
||
|
(require/activate imperative-syndicate/drivers/tcp)
|
||
|
(require/activate imperative-syndicate/drivers/web)
|
||
|
|
||
|
(define (main)
|
||
|
(spawn #:name 'server-listener
|
||
|
(define tcp-scope "broker")
|
||
|
(during/spawn (tcp-connection $id (tcp-listener 8001))
|
||
|
#:name `(server-connection ,tcp-scope ,id)
|
||
|
(server-facet/tcp id tcp-scope))
|
||
|
|
||
|
(during/spawn (http-request $id 'get (http-resource (http-server _ 8000 #f)
|
||
|
`(,$scope ())) _ _ _)
|
||
|
#:name `(server-connection ,scope ,id)
|
||
|
(server-facet/websocket id scope))))
|
||
|
|
||
|
(module+ main
|
||
|
(let ((go (current-ground-dataspace)))
|
||
|
(current-ground-dataspace
|
||
|
(lambda (boot-proc)
|
||
|
(go (lambda ()
|
||
|
(boot-proc)
|
||
|
(main)))))))
|