summaryrefslogtreecommitdiff
path: root/web/socket/client.scm
Commit message (Collapse)AuthorAgeFilesLines
* client: Support read timeouts on receive & close.Andrew Whatson2023-05-071-14/+13
| | | | | | | | | | | | * web/socket/client.scm (close-websocket): Add timeout parameter. Call read-close-frame with timeout. (websocket-receive): Add timeout parameter. Call read-data-frame with timeout. Don't close the websocket on timeout. * web/socket/frame.scm (port-readable?, port-writable?, frame-reader): New helper procedures. (read-close-frame): New procedure. (read-data-frame): Add timeout parameter. Use frame-reader to support a composed read timeout.
* client: Handle control frames in websocket-receive.Andrew Whatson2023-04-211-6/+13
| | | | | | | | | * web/socket/frame.scm (read-data-frame): New procedure, extracted from serve-client. * web/socket/client.scm (websocket-receive): Call read-data-frame. Clean up the websocket if the connection was closed. * web/socket/server.scm (serve-client): Call read-data-frame. Flush the port after writing the handshake response.
* client: Support secure websockets.Andrew Whatson2023-04-191-20/+25
| | | | | | | | | * web/socket/client.scm (make-client-socket): Add verify-certificate? parameter. Call open-socket-for-uri to create the socket. (handshake): Flush the port after writing the request. (make-websocket): Add #:verify-certificate? parameter. * web/socket/frame.scm (write-frame): Flush the port after writing the frame.
* mingw: Hack for missing /dev/urandom.Jan (janneke) Nieuwenhuizen2021-03-181-3/+8
| | | | | * web/socket/client.scm (open-entropy-port): Add hack for missing /dev/urandom.
* client: Export websocket-socket.Jan (janneke) Nieuwenhuizen2021-03-181-0/+2
| | | | * web/socket/client.scm (web): Export websocket-socket.
* client: Return no values from close-websocket.David Thompson2016-03-251-1/+2
| | | | * web/socket/client.scm (close-websocket): Return an unspecified value.
* client: Validate accept key when handshaking.David Thompson2016-03-251-25/+25
| | | | | | | * web/socket/client.scm (generate-websocket-nonce): Rename to... (generate-client-key): ...this. (make-handshake-request): Change argument list. (handshake): Validate accept key.
* client: Mask sent frames.David Thompson2016-03-251-2/+6
| | | | | * web/socket/client.scm (generate-masking-key): New procedure. (websocket-send): Mask the frame to be sent.
* client: Generate random nonce for handshake.David Thompson2016-03-251-5/+11
| | | | | | | * web/socket/client.scm (generate-websocket-nonce): New procedure. (make-handshake-request): Change argument from uri to websocket. Generate a real nonce for Sec-WebSocket-Key header. (handshake): Adjust make-handshake-request call.
* client: Add entropy source.David Thompson2016-03-251-2/+14
| | | | | | | * web/socket/client.scm (<websocket>)[entropy-port]: New field. (open-entropy-port): New procedure. (make-websocket): Open entropy port. (close-websocket): Close entropy port.
* client: Add custom printer for <websocket>.David Thompson2016-03-251-0/+8
| | | | | * web/socket/client.scm (display-websocket): New procedure. (<websocket>): Set custom record type printer.
* client: Keep track of socket state.David Thompson2016-03-251-12/+37
| | | | | | | | | | | * web/socket/client.scm (<websocket>)[state]: New field. (websocket-state, set-websocket-state!): New field accessors. (websocket-connecting?, websocket-open?, websocket-closing?, websocket-closed?): New procedures. (handshake): Set socket to 'open' state after successful handshake. (make-websocket): Set socket to 'connecting' state initially. (close-websocket): Set socket to 'closing' before sending close frame, and then to 'closed' underlying TCP socket is closed.
* client: Wait for server to close connection.David Thompson2016-03-251-1/+12
| | | | | * web/socket/client.scm (close-websocket): Wait for server to close the connection for a reasonable amount of time.
* Add client module.David Thompson2016-03-241-0/+143