(pk 'web-server (create-actor nm <websocket-server>
#:port web-server-port
#:http-handler (wrap-apply http-handler)
- #:websocket-handler (wrap-apply websocket-handler)))))
+ #:on-ws-message (wrap-apply websocket-new-message)))))
(define (view:main-display request body)
(define one-entry
;; Respond to text messages by reversing the message. Respond to
;; binary messages with "hello".
-(define (websocket-handler data)
- (if (string? data)
- (string-reverse data)
- "hello"))
+(define (websocket-new-message websocket-server client-id data)
+ (<- (actor-id websocket-server) 'ws-send
+ client-id
+ (if (string? data)
+ (string-reverse data)
+ "hello")))