From f57eeffa5b26c095fc356eccaca25c2611c9db1e Mon Sep 17 00:00:00 2001 From: David Thompson Date: Fri, 25 Mar 2016 15:06:56 -0400 Subject: client: Add custom printer for . * web/socket/client.scm (display-websocket): New procedure. (): Set custom record type printer. --- web/socket/client.scm | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'web/socket') 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 "#" + (uri->string (websocket-uri ws)) + (websocket-state ws))) + +(set-record-type-printer! display-websocket) + (define (websocket-connecting? ws) "Return #t if the WebSocket WS is in the connecting state." (eq? (websocket-state ws) 'connecting)) -- cgit v1.2.3