From 4fc29ba8a26e0c04c94037ec77c778cb08dff29c Mon Sep 17 00:00:00 2001 From: David Thompson Date: Tue, 1 Dec 2015 23:01:04 -0500 Subject: frame: Add make-ping-frame. * web/socket/frame.scm (make-ping-frame): New procedure. --- web/socket/frame.scm | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/web/socket/frame.scm b/web/socket/frame.scm index 3bd56f7..0b358ae 100644 --- a/web/socket/frame.scm +++ b/web/socket/frame.scm @@ -40,6 +40,7 @@ frame-masking-key frame-data + make-ping-frame make-pong-frame make-close-frame make-text-frame @@ -86,24 +87,30 @@ (set-record-type-printer! display-frame) -(define* (make-pong-frame bv #:optional (masking-key #f)) +(define* (make-ping-frame bv #:optional masking-key) + "Return a \"ping\" control frame containing the contents of the +bytevector BV, masked with MASKING-KEY. By default, the data is +unmasked." + (make-frame #t 'ping masking-key bv)) + +(define* (make-pong-frame bv #:optional masking-key) "Return a \"pong\" control frame containing the contents of the bytevector BV, masked with MASKING-KEY. By default, the data is unmasked." (make-frame #t 'pong masking-key bv)) -(define* (make-close-frame bv #:optional (masking-key #f)) +(define* (make-close-frame bv #:optional masking-key) "Return a \"close\" control frame containing the contents of the bytevector BV, masked with MASKING-KEY. By default, the data is unmasked." (make-frame #t 'close masking-key bv)) -(define* (make-text-frame text #:optional (masking-key #f)) +(define* (make-text-frame text #:optional masking-key) "Return a text data frame containing the string TEXT, masked with MASKING-KEY. By default, the text is unmasked." (make-frame #t 'text masking-key (string->utf8 text))) -(define* (make-binary-frame bv #:optional (masking-key #f)) +(define* (make-binary-frame bv #:optional masking-key) "Return a binary data frame containing the contents of the bytevector BV, masked with MASKING-KEY. By default, the data is unmasked." -- cgit v1.2.3