X-Git-Url: https://jxself.org/git/?p=mudsync.git;a=blobdiff_plain;f=mudsync%2Fnetworking.scm;h=228a89fd4377da5da2ec4ada75fddb4127402d4b;hp=1a8ece5002b4e47fad5c433e3e9cace5cdc8863c;hb=e8015ebb1351ace6536cfe04aab1e29c26f22366;hpb=5b9d1025df991e96148eeefe5fb9653e033e7f82 diff --git a/mudsync/networking.scm b/mudsync/networking.scm index 1a8ece5..228a89f 100644 --- a/mudsync/networking.scm +++ b/mudsync/networking.scm @@ -26,6 +26,9 @@ #:use-module (ice-9 receive) #:use-module (oop goops) + ;; Formatting + #:use-module (sxml simple) + ;; used by web server only #:use-module (sxml simple) #:use-module (web request) @@ -190,16 +193,20 @@ (define* (nm-send-to-client-id nm message #:key client data) "Send DATA to TO-CLIENT id" + (define formatted-data + (call-with-output-string + (lambda (p) + (sxml->xml data p)))) (define client-obj (hash-ref (nm-clients nm) client)) (match client-obj (#f (throw 'no-such-client "Asked to send data to client but that client doesn't exist" #:client-id client - #:data data)) + #:data formatted-data)) (('socket . client-socket) - (display data client-socket)) + (display formatted-data client-socket)) (('websocket . ws-client-id) - (<- (.web-server nm) 'ws-send ws-client-id data)))) + (<- (.web-server nm) 'ws-send ws-client-id formatted-data)))) (define (nm-incoming-line-action nm message client-id line) "Handle LINE coming in, probably from an external message handler,