reply using new reply method
authorChristopher Allan Webber <cwebber@dustycloud.org>
Sat, 21 Jan 2017 00:15:59 +0000 (18:15 -0600)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Sat, 21 Jan 2017 00:15:59 +0000 (18:15 -0600)
mudsync/networking.scm

index 1c28b38dcbb4ef872c8e1663e5fa12dac2eb6329..e553e01e811dfe85a55de611722966afae6b2dc7 100644 (file)
         (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")))