- (define client-obj (hash-ref (nm-clients nm) client-id))
- (if (not client-obj)
- (throw 'no-such-client
- "Asked to send data to client but that client doesn't exist"
- #:client-id client-id
- #:data data))
- (display data client-obj))
+ (define formatted-data
+ (scrubl-write scrubl-sxml data))
+ (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 formatted-data))
+ (('socket . client-socket)
+ (display formatted-data client-socket))
+ (('websocket . ws-client-id)
+ (<- (.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,
+like the web one"
+ (nm-handle-line nm client-id line))