Beryl::TLS::Server
Inherits Socket::Server < Reference < Object
Wraps a ::Socket::Server (such as a TCPServer) so each accepted
connection is a Socket::Server, as OpenSSL::SSL::Server does.
HTTP::Server#bind(server) takes it on stock Crystal.
tcp_server = TCPServer.new("0.0.0.0", 8443)
http_server.bind(Beryl::TLS::Server.new(tcp_server, context))
Constructors
Instance methods
Accepts an incoming connection and returns the client socket.
require "socket"
server = TCPServer.new(2202)
while true
socket = server.accept
socket.puts Time.utc
socket.close
end
If the server is closed after invoking this method, an IO::Error (closed stream) exception must be raised.
Accepts an incoming connection and returns the client socket.
Returns nil if the server is closed after invoking this method.
require "socket"
server = TCPServer.new(2202)
while socket = server.accept?
socket.puts Time.utc
socket.close
end
Whether the handshake runs in accept; off by default, so the
handshake runs in the connection's own fiber on first use.
Whether the handshake runs in accept; off by default, so the
handshake runs in the connection's own fiber on first use.
Whether each accepted TCPSocket gets TCP_NODELAY; on by default.
Each WebSocket message or HTTP response goes out as one TLS record in
one write, and with Nagle on a small write waits for the ACK of the one
before it, which a peer delaying its ACKs holds back for up to 40 ms on
Linux. Turn it off only for a server that writes few, large records.
Whether each accepted TCPSocket gets TCP_NODELAY; on by default.
Each WebSocket message or HTTP response goes out as one TLS record in
one write, and with Nagle on a small write waits for the ACK of the one
before it, which a peer delaying its ACKs holds back for up to 40 ms on
Linux. Turn it off only for a server that writes few, large records.