X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=mudsync%2Fnetworking.scm;h=2a193ae5d0d144b34a9d07e006b1c0abc84da576;hb=086e3362830393bcd51a3d79fe50c66ca15b7112;hp=228a89fd4377da5da2ec4ada75fddb4127402d4b;hpb=e8015ebb1351ace6536cfe04aab1e29c26f22366;p=mudsync.git diff --git a/mudsync/networking.scm b/mudsync/networking.scm index 228a89f..2a193ae 100644 --- a/mudsync/networking.scm +++ b/mudsync/networking.scm @@ -27,7 +27,7 @@ #:use-module (oop goops) ;; Formatting - #:use-module (sxml simple) + #:use-module (mudsync scrubl) ;; used by web server only #:use-module (sxml simple) @@ -60,7 +60,8 @@ (web-server-port %default-web-server-port)) (if web-server-port (nm-install-web-server actor server web-server-port)) - (nm-install-socket actor server port))) + ;; (nm-install-socket actor server port) + )) (send-to-client nm-send-to-client-id) (new-socket-client nm-new-socket-client) (new-web-client nm-new-web-client) @@ -164,7 +165,7 @@ (hash-set! (nm-clients nm) client-id (cons 'websocket ws-client-id)) (<- (nm-send-input-to nm) 'new-client #:client client-id) - (<-reply message client-id)) + client-id) (define (nm-client-receive-loop nm client-socket client-id) "Make a method to receive client data" @@ -183,20 +184,18 @@ "Handle a closed port" (format #t "DEBUG: handled closed port ~a\n" client-id) (hash-remove! (nm-clients nm) client-id) - (<-* `(#:actor ,nm) (nm-send-input-to nm) 'client-closed #:client client-id)) + (<- (nm-send-input-to nm) 'client-closed #:client client-id)) (define (nm-handle-line nm client-id line) "Handle an incoming line of input from a client" - (<-* `(#:actor ,nm) (nm-send-input-to nm) 'client-input + (<- (nm-send-input-to nm) 'client-input #:data line #:client client-id)) (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)))) + (scrubl-write scrubl-sxml data)) (define client-obj (hash-ref (nm-clients nm) client)) (match client-obj (#f (throw 'no-such-client @@ -228,7 +227,7 @@ like the web one" (define (nm-install-web-server nm server web-server-port) "This installs the web server, which we see in use below...." (set! (.web-server nm) - (create-actor nm + (create-actor #:network-manager (actor-id nm) #:port web-server-port #:http-handler (wrap-apply http-handler) @@ -251,7 +250,11 @@ like the web one" ;; (p (b "") " Last one!")) )) (div (@ (id "input-metabox")) - (input (@ (id "main-input")))))) + (input (@ (id "main-input"))) + " " + (span (@ (id "connection-status") + (class "disconnected")) + "[disconnected]")))) (define (main-tmpl) `(html (@ (xmlns "http://www.w3.org/1999/xhtml")) @@ -313,8 +316,8 @@ like the web one" (define (websocket-client-connect websocket-server client-id) (let ((nm-client-id - (mbody-val (<-wait (.network-manager websocket-server) - 'new-web-client client-id)))) + (<-wait (.network-manager websocket-server) + 'new-web-client client-id))) (hash-set! (.nm-client-ids websocket-server) client-id nm-client-id)))