+(define (websocket-new-message websocket-server client-id data)
+ (cond
+ ((string? data)
+ (<- (.network-manager websocket-server) 'incoming-line
+ (hash-ref (.nm-client-ids websocket-server)
+ client-id)
+ data))
+ ;; binary data is ignored
+ (else #f)))
+
+(define (websocket-client-connect websocket-server client-id)
+ (let ((nm-client-id
+ (mbody-val (<-wait (.network-manager websocket-server)
+ 'new-web-client client-id))))
+ (hash-set! (.nm-client-ids websocket-server)
+ client-id nm-client-id)))
+
+(define (websocket-client-disconnect websocket-server client-id)
+ (<- (.network-manager websocket-server) 'client-disconnected
+ (hash-ref (.nm-client-ids websocket-server) client-id))
+ (hash-remove! (.nm-client-ids websocket-server) client-id))