diff options
Diffstat (limited to 'web/socket/client.scm')
-rw-r--r-- | web/socket/client.scm | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/web/socket/client.scm b/web/socket/client.scm index 3c32894..8a96494 100644 --- a/web/socket/client.scm +++ b/web/socket/client.scm @@ -28,6 +28,7 @@ #:use-module (rnrs bytevectors) #:use-module (rnrs io ports) #:use-module (srfi srfi-9) + #:use-module (srfi srfi-9 gnu) #:use-module (web request) #:use-module (web response) #:use-module (web uri) @@ -86,6 +87,13 @@ scheme." (socket websocket-socket) (state websocket-state set-websocket-state!)) +(define (display-websocket ws port) + (format port "#<websocket ~a ~a>" + (uri->string (websocket-uri ws)) + (websocket-state ws))) + +(set-record-type-printer! <websocket> display-websocket) + (define (websocket-connecting? ws) "Return #t if the WebSocket WS is in the connecting state." (eq? (websocket-state ws) 'connecting)) |