SslServer

Instance of

Class

Inherits from

TcpServer

Description

SSL server listens for secure sockets (such as SSL or TLS) connections.

Example

// Simple HTTPS server
let tcpServer = SslServer("cert.pem", "cert.key");
await tcpServer.bind(3003);
while (true) {
    try {
        let tcpClientB = await tcpServer.listen();
        let time = Time.sinceEpoch.asFloatingPoint();
        await tcpClientB.receive();
        await tcpClientB.send("HTTP/1.1 200 OK\r\n"+
                            "Server: Easypt ssl example\r\n"+
                            "Content-Length: 48\r\n"+
                            "Content-Type: text/html\r\n"+
                            "Connection: Closed\r\n\r\n"+
                            "<html>"+
                            "<body>"+
                            "<h1>Hello, World!</h1>"+
                            "</body>"+
                            "</html>");
        console.log(Time.sinceEpoch.asFloatingPoint() - time);
    } catch {
        console.error(exception);
    }
}

Members

Inherited members

Properties

  • classPrototype