feat: add example scripts for argparse, bytes, dataset, html, markdown, uuid, wdantic, and web chat modules
Add comprehensive demo scripts showcasing the usage of multiple Wren modules including argument parsing, byte manipulation, in-memory dataset operations, HTML encoding/slugification, markdown-to-HTML conversion, UUID generation/validation, schema validation with wdantic, and a full web chat application with REST endpoints.
2026-01-24 23:40:22 +01:00
<!DOCTYPE html>
<!-- retoor <retoor@molodetz.nl> -->
< html lang = "en" >
< head >
< meta charset = "UTF-8" >
< meta name = "viewport" content = "width=device-width, initial-scale=1.0" >
< title > tls - Wren-CLI Manual< / title >
< link rel = "stylesheet" href = "../css/style.css" >
< / head >
< body >
< button class = "mobile-menu-toggle" > Menu< / button >
< div class = "container" >
< aside class = "sidebar" >
< div class = "sidebar-header" >
< h1 > < a href = "../index.html" > Wren-CLI< / a > < / h1 >
< div class = "version" > v0.4.0< / div >
< / div >
< nav class = "sidebar-nav" >
< div class = "section" >
< span class = "section-title" > Getting Started< / span >
< ul >
< li > < a href = "../getting-started/index.html" > Overview< / a > < / li >
< li > < a href = "../getting-started/installation.html" > Installation< / a > < / li >
< li > < a href = "../getting-started/first-script.html" > First Script< / a > < / li >
< li > < a href = "../getting-started/repl.html" > Using the REPL< / a > < / li >
< / ul >
< / div >
< div class = "section" >
< span class = "section-title" > Language< / span >
< ul >
< li > < a href = "../language/index.html" > Syntax Overview< / a > < / li >
< li > < a href = "../language/classes.html" > Classes< / a > < / li >
< li > < a href = "../language/methods.html" > Methods< / a > < / li >
< li > < a href = "../language/control-flow.html" > Control Flow< / a > < / li >
< li > < a href = "../language/fibers.html" > Fibers< / a > < / li >
< li > < a href = "../language/modules.html" > Modules< / a > < / li >
< / ul >
< / div >
< div class = "section" >
< span class = "section-title" > API Reference< / span >
< ul >
< li > < a href = "index.html" > Overview< / a > < / li >
feat: add async/await keywords, Num/String extensions, and Jinja markdown example
Add `async` and `await` token support to the Wren compiler with scheduler resolution logic, extend `Num` with `e` constant, hyperbolic trig, base conversion, and new methods (`isZero`, `gcd`, `lcm`, `digits`, etc.), extend `String` with `lower`, `upper`, `capitalize`, `title`, and regenerate `wren_core.wren.inc`. Include `Makefile` for multi-platform builds, rewrite `README.md` with updated build instructions, and add `example/await_demo.wren` and `example/jinja_markdown.wren` demonstrating new features.
2026-01-25 04:58:39 +01:00
< li > < a href = "string.html" > String< / a > < / li >
< li > < a href = "number.html" > Num< / a > < / li >
feat: add fswatch, sysinfo, and udp demo scripts plus reorder manual sidebar links
Add three new example scripts demonstrating the fswatch, sysinfo, and udp modules with file watching, system metrics, and UDP echo server/client patterns. Reorder the manual API sidebar navigation to list modules alphabetically, removing deprecated entries like websocket, tls, net, json, regex, jinja, os, signal, subprocess, sqlite, and timer while adding argparse, dataset, fswatch, and html.
2026-01-25 13:09:28 +01:00
< li > < a href = "argparse.html" > argparse< / a > < / li >
feat: add example scripts for argparse, bytes, dataset, html, markdown, uuid, wdantic, and web chat modules
Add comprehensive demo scripts showcasing the usage of multiple Wren modules including argument parsing, byte manipulation, in-memory dataset operations, HTML encoding/slugification, markdown-to-HTML conversion, UUID generation/validation, schema validation with wdantic, and a full web chat application with REST endpoints.
2026-01-24 23:40:22 +01:00
< li > < a href = "base64.html" > base64< / a > < / li >
< li > < a href = "crypto.html" > crypto< / a > < / li >
feat: add fswatch, sysinfo, and udp demo scripts plus reorder manual sidebar links
Add three new example scripts demonstrating the fswatch, sysinfo, and udp modules with file watching, system metrics, and UDP echo server/client patterns. Reorder the manual API sidebar navigation to list modules alphabetically, removing deprecated entries like websocket, tls, net, json, regex, jinja, os, signal, subprocess, sqlite, and timer while adding argparse, dataset, fswatch, and html.
2026-01-25 13:09:28 +01:00
< li > < a href = "dataset.html" > dataset< / a > < / li >
feat: add example scripts for argparse, bytes, dataset, html, markdown, uuid, wdantic, and web chat modules
Add comprehensive demo scripts showcasing the usage of multiple Wren modules including argument parsing, byte manipulation, in-memory dataset operations, HTML encoding/slugification, markdown-to-HTML conversion, UUID generation/validation, schema validation with wdantic, and a full web chat application with REST endpoints.
2026-01-24 23:40:22 +01:00
< li > < a href = "datetime.html" > datetime< / a > < / li >
feat: add fswatch, sysinfo, and udp demo scripts plus reorder manual sidebar links
Add three new example scripts demonstrating the fswatch, sysinfo, and udp modules with file watching, system metrics, and UDP echo server/client patterns. Reorder the manual API sidebar navigation to list modules alphabetically, removing deprecated entries like websocket, tls, net, json, regex, jinja, os, signal, subprocess, sqlite, and timer while adding argparse, dataset, fswatch, and html.
2026-01-25 13:09:28 +01:00
< li > < a href = "dns.html" > dns< / a > < / li >
< li > < a href = "env.html" > env< / a > < / li >
< li > < a href = "fswatch.html" > fswatch< / a > < / li >
< li > < a href = "html.html" > html< / a > < / li >
< li > < a href = "http.html" > http< / a > < / li >
feat: add example scripts for argparse, bytes, dataset, html, markdown, uuid, wdantic, and web chat modules
Add comprehensive demo scripts showcasing the usage of multiple Wren modules including argument parsing, byte manipulation, in-memory dataset operations, HTML encoding/slugification, markdown-to-HTML conversion, UUID generation/validation, schema validation with wdantic, and a full web chat application with REST endpoints.
2026-01-24 23:40:22 +01:00
< li > < a href = "io.html" > io< / a > < / li >
feat: add fswatch, sysinfo, and udp demo scripts plus reorder manual sidebar links
Add three new example scripts demonstrating the fswatch, sysinfo, and udp modules with file watching, system metrics, and UDP echo server/client patterns. Reorder the manual API sidebar navigation to list modules alphabetically, removing deprecated entries like websocket, tls, net, json, regex, jinja, os, signal, subprocess, sqlite, and timer while adding argparse, dataset, fswatch, and html.
2026-01-25 13:09:28 +01:00
< li > < a href = "jinja.html" > jinja< / a > < / li >
< li > < a href = "json.html" > json< / a > < / li >
< li > < a href = "markdown.html" > markdown< / a > < / li >
< li > < a href = "math.html" > math< / a > < / li >
< li > < a href = "net.html" > net< / a > < / li >
< li > < a href = "os.html" > os< / a > < / li >
feat: add async/await keywords, Num/String extensions, and Jinja markdown example
Add `async` and `await` token support to the Wren compiler with scheduler resolution logic, extend `Num` with `e` constant, hyperbolic trig, base conversion, and new methods (`isZero`, `gcd`, `lcm`, `digits`, etc.), extend `String` with `lower`, `upper`, `capitalize`, `title`, and regenerate `wren_core.wren.inc`. Include `Makefile` for multi-platform builds, rewrite `README.md` with updated build instructions, and add `example/await_demo.wren` and `example/jinja_markdown.wren` demonstrating new features.
2026-01-25 04:58:39 +01:00
< li > < a href = "pathlib.html" > pathlib< / a > < / li >
feat: add fswatch, sysinfo, and udp demo scripts plus reorder manual sidebar links
Add three new example scripts demonstrating the fswatch, sysinfo, and udp modules with file watching, system metrics, and UDP echo server/client patterns. Reorder the manual API sidebar navigation to list modules alphabetically, removing deprecated entries like websocket, tls, net, json, regex, jinja, os, signal, subprocess, sqlite, and timer while adding argparse, dataset, fswatch, and html.
2026-01-25 13:09:28 +01:00
< li > < a href = "regex.html" > regex< / a > < / li >
feat: add example scripts for argparse, bytes, dataset, html, markdown, uuid, wdantic, and web chat modules
Add comprehensive demo scripts showcasing the usage of multiple Wren modules including argument parsing, byte manipulation, in-memory dataset operations, HTML encoding/slugification, markdown-to-HTML conversion, UUID generation/validation, schema validation with wdantic, and a full web chat application with REST endpoints.
2026-01-24 23:40:22 +01:00
< li > < a href = "scheduler.html" > scheduler< / a > < / li >
feat: add fswatch, sysinfo, and udp demo scripts plus reorder manual sidebar links
Add three new example scripts demonstrating the fswatch, sysinfo, and udp modules with file watching, system metrics, and UDP echo server/client patterns. Reorder the manual API sidebar navigation to list modules alphabetically, removing deprecated entries like websocket, tls, net, json, regex, jinja, os, signal, subprocess, sqlite, and timer while adding argparse, dataset, fswatch, and html.
2026-01-25 13:09:28 +01:00
< li > < a href = "signal.html" > signal< / a > < / li >
< li > < a href = "sqlite.html" > sqlite< / a > < / li >
< li > < a href = "subprocess.html" > subprocess< / a > < / li >
< li > < a href = "sysinfo.html" > sysinfo< / a > < / li >
< li > < a href = "tempfile.html" > tempfile< / a > < / li >
< li > < a href = "timer.html" > timer< / a > < / li >
< li > < a href = "tls.html" class = "active" > tls< / a > < / li >
< li > < a href = "udp.html" > udp< / a > < / li >
< li > < a href = "uuid.html" > uuid< / a > < / li >
< li > < a href = "wdantic.html" > wdantic< / a > < / li >
< li > < a href = "web.html" > web< / a > < / li >
< li > < a href = "websocket.html" > websocket< / a > < / li >
feat: add example scripts for argparse, bytes, dataset, html, markdown, uuid, wdantic, and web chat modules
Add comprehensive demo scripts showcasing the usage of multiple Wren modules including argument parsing, byte manipulation, in-memory dataset operations, HTML encoding/slugification, markdown-to-HTML conversion, UUID generation/validation, schema validation with wdantic, and a full web chat application with REST endpoints.
2026-01-24 23:40:22 +01:00
< / ul >
< / div >
< div class = "section" >
< span class = "section-title" > Tutorials< / span >
< ul >
< li > < a href = "../tutorials/index.html" > Tutorial List< / a > < / li >
feat: add fswatch, sysinfo, and udp demo scripts plus reorder manual sidebar links
Add three new example scripts demonstrating the fswatch, sysinfo, and udp modules with file watching, system metrics, and UDP echo server/client patterns. Reorder the manual API sidebar navigation to list modules alphabetically, removing deprecated entries like websocket, tls, net, json, regex, jinja, os, signal, subprocess, sqlite, and timer while adding argparse, dataset, fswatch, and html.
2026-01-25 13:09:28 +01:00
< li > < a href = "../tutorials/http-client.html" > HTTP Client< / a > < / li >
< li > < a href = "../tutorials/websocket-chat.html" > WebSocket Chat< / a > < / li >
< li > < a href = "../tutorials/database-app.html" > Database App< / a > < / li >
< li > < a href = "../tutorials/template-rendering.html" > Templates< / a > < / li >
< li > < a href = "../tutorials/cli-tool.html" > CLI Tool< / a > < / li >
feat: add buildmanual target, faker demo, subprocess examples, and contributing sidebar to manual
Add Makefile buildmanual target for manual generation and include faker_demo.wren, subprocess_async_demo.wren, subprocess_concurrent_demo.wren, and subprocess_fiber_demo.wren example scripts. Update manual sidebar across api pages to link new web-server tutorial and contributing section with module architecture, pure-wren/c-backed modules, foreign classes, async patterns, testing, and documentation pages.
2026-01-25 19:02:02 +01:00
< li > < a href = "../tutorials/web-server.html" > Web Server< / a > < / li >
feat: add example scripts for argparse, bytes, dataset, html, markdown, uuid, wdantic, and web chat modules
Add comprehensive demo scripts showcasing the usage of multiple Wren modules including argument parsing, byte manipulation, in-memory dataset operations, HTML encoding/slugification, markdown-to-HTML conversion, UUID generation/validation, schema validation with wdantic, and a full web chat application with REST endpoints.
2026-01-24 23:40:22 +01:00
< / ul >
< / div >
< div class = "section" >
< span class = "section-title" > How-To Guides< / span >
< ul >
< li > < a href = "../howto/index.html" > How-To List< / a > < / li >
feat: add fswatch, sysinfo, and udp demo scripts plus reorder manual sidebar links
Add three new example scripts demonstrating the fswatch, sysinfo, and udp modules with file watching, system metrics, and UDP echo server/client patterns. Reorder the manual API sidebar navigation to list modules alphabetically, removing deprecated entries like websocket, tls, net, json, regex, jinja, os, signal, subprocess, sqlite, and timer while adding argparse, dataset, fswatch, and html.
2026-01-25 13:09:28 +01:00
< li > < a href = "../howto/http-requests.html" > HTTP Requests< / a > < / li >
< li > < a href = "../howto/json-parsing.html" > JSON Parsing< / a > < / li >
< li > < a href = "../howto/regex-patterns.html" > Regex Patterns< / a > < / li >
< li > < a href = "../howto/file-operations.html" > File Operations< / a > < / li >
< li > < a href = "../howto/async-operations.html" > Async Operations< / a > < / li >
< li > < a href = "../howto/error-handling.html" > Error Handling< / a > < / li >
feat: add example scripts for argparse, bytes, dataset, html, markdown, uuid, wdantic, and web chat modules
Add comprehensive demo scripts showcasing the usage of multiple Wren modules including argument parsing, byte manipulation, in-memory dataset operations, HTML encoding/slugification, markdown-to-HTML conversion, UUID generation/validation, schema validation with wdantic, and a full web chat application with REST endpoints.
2026-01-24 23:40:22 +01:00
< / ul >
< / div >
feat: add buildmanual target, faker demo, subprocess examples, and contributing sidebar to manual
Add Makefile buildmanual target for manual generation and include faker_demo.wren, subprocess_async_demo.wren, subprocess_concurrent_demo.wren, and subprocess_fiber_demo.wren example scripts. Update manual sidebar across api pages to link new web-server tutorial and contributing section with module architecture, pure-wren/c-backed modules, foreign classes, async patterns, testing, and documentation pages.
2026-01-25 19:02:02 +01:00
< div class = "section" >
< span class = "section-title" > Contributing< / span >
< ul >
< li > < a href = "../contributing/index.html" > Overview< / a > < / li >
< li > < a href = "../contributing/module-overview.html" > Module Architecture< / a > < / li >
< li > < a href = "../contributing/pure-wren-module.html" > Pure-Wren Modules< / a > < / li >
< li > < a href = "../contributing/c-backed-module.html" > C-Backed Modules< / a > < / li >
< li > < a href = "../contributing/foreign-classes.html" > Foreign Classes< / a > < / li >
< li > < a href = "../contributing/async-patterns.html" > Async Patterns< / a > < / li >
< li > < a href = "../contributing/testing.html" > Writing Tests< / a > < / li >
< li > < a href = "../contributing/documentation.html" > Documentation< / a > < / li >
< / ul >
< / div >
feat: add example scripts for argparse, bytes, dataset, html, markdown, uuid, wdantic, and web chat modules
Add comprehensive demo scripts showcasing the usage of multiple Wren modules including argument parsing, byte manipulation, in-memory dataset operations, HTML encoding/slugification, markdown-to-HTML conversion, UUID generation/validation, schema validation with wdantic, and a full web chat application with REST endpoints.
2026-01-24 23:40:22 +01:00
< / nav >
< / aside >
< main class = "content" >
< nav class = "breadcrumb" >
< a href = "../index.html" > Home< / a >
< span class = "separator" > /< / span >
< a href = "index.html" > API Reference< / a >
< span class = "separator" > /< / span >
< span > tls< / span >
< / nav >
< article >
< h1 > tls< / h1 >
< p > The < code > tls< / code > module provides SSL/TLS socket support for secure network connections. It uses OpenSSL for encryption and is used internally by the < code > http< / code > module for HTTPS connections.< / p >
< pre > < code > import "tls" for TlsSocket< / code > < / pre >
< div class = "toc" >
< h4 > On This Page< / h4 >
< ul >
< li > < a href = "#tlssocket-class" > TlsSocket Class< / a > < / li >
< li > < a href = "#examples" > Examples< / a > < / li >
< / ul >
< / div >
< h2 id = "tlssocket-class" > TlsSocket Class< / h2 >
< div class = "class-header" >
< h3 > TlsSocket< / h3 >
< p > SSL/TLS encrypted socket connection< / p >
< / div >
< h3 > Static Methods< / h3 >
< div class = "method-signature" >
< span class = "method-name" > TlsSocket.connect< / span > (< span class = "param" > host< / span > , < span class = "param" > port< / span > , < span class = "param" > hostname< / span > ) → < span class = "type" > TlsSocket< / span >
< / div >
< p > Establishes a TLS connection to a remote server.< / p >
< ul class = "param-list" >
< li > < span class = "param-name" > host< / span > < span class = "param-type" > (String)< / span > - IP address to connect to< / li >
< li > < span class = "param-name" > port< / span > < span class = "param-type" > (Num)< / span > - Port number (typically 443 for HTTPS)< / li >
< li > < span class = "param-name" > hostname< / span > < span class = "param-type" > (String)< / span > - Server hostname for SNI (Server Name Indication)< / li >
< li > < span class = "returns" > Returns:< / span > Connected TlsSocket instance< / li >
< / ul >
< pre > < code > var socket = TlsSocket.connect("93.184.216.34", 443, "example.com")< / code > < / pre >
< h3 > Methods< / h3 >
< div class = "method-signature" >
< span class = "method-name" > write< / span > (< span class = "param" > text< / span > )
< / div >
< p > Writes data to the TLS connection. This is an async operation that blocks until the data is sent.< / p >
< ul class = "param-list" >
< li > < span class = "param-name" > text< / span > < span class = "param-type" > (String)< / span > - Data to send< / li >
< / ul >
< pre > < code > socket.write("GET / HTTP/1.1\r\nHost: example.com\r\n\r\n")< / code > < / pre >
< div class = "method-signature" >
< span class = "method-name" > read< / span > () → < span class = "type" > String|null< / span >
< / div >
< p > Reads data from the TLS connection. Blocks until data is available. Returns null when the connection is closed.< / p >
< ul class = "param-list" >
< li > < span class = "returns" > Returns:< / span > Data received as a string, or null if connection closed< / li >
< / ul >
< pre > < code > var data = socket.read()
if (data != null) {
System.print(data)
}< / code > < / pre >
< div class = "method-signature" >
< span class = "method-name" > close< / span > ()
< / div >
< p > Closes the TLS connection and releases resources.< / p >
< pre > < code > socket.close()< / code > < / pre >
< h2 id = "examples" > Examples< / h2 >
< h3 > Basic HTTPS Request< / h3 >
< pre > < code > import "tls" for TlsSocket
import "dns" for Dns
var host = "example.com"
var ip = Dns.lookup(host)
var socket = TlsSocket.connect(ip, 443, host)
socket.write("GET / HTTP/1.1\r\n")
socket.write("Host: %(host)\r\n")
socket.write("Connection: close\r\n")
socket.write("\r\n")
var response = ""
while (true) {
var chunk = socket.read()
if (chunk == null) break
response = response + chunk
}
socket.close()
System.print(response)< / code > < / pre >
< h3 > Reading Until Complete< / h3 >
< pre > < code > import "tls" for TlsSocket
import "dns" for Dns
var host = "api.example.com"
var ip = Dns.lookup(host)
var socket = TlsSocket.connect(ip, 443, host)
socket.write("GET /data HTTP/1.1\r\n")
socket.write("Host: %(host)\r\n")
socket.write("Accept: application/json\r\n")
socket.write("Connection: close\r\n\r\n")
var buffer = ""
while (true) {
var data = socket.read()
if (data == null) break
buffer = buffer + data
}
socket.close()
var bodyStart = buffer.indexOf("\r\n\r\n")
if (bodyStart != -1) {
var body = buffer[bodyStart + 4..-1]
System.print("Response body: %(body)")
}< / code > < / pre >
< h3 > Using with DNS Resolution< / h3 >
< pre > < code > import "tls" for TlsSocket
import "dns" for Dns
var hostname = "secure.example.com"
var ip = Dns.lookup(hostname, 4)
System.print("Connecting to %(ip)")
var socket = TlsSocket.connect(ip, 443, hostname)
socket.write("GET /secure-endpoint HTTP/1.1\r\nHost: %(hostname)\r\n\r\n")
var response = socket.read()
System.print(response)
socket.close()< / code > < / pre >
< div class = "admonition note" >
< div class = "admonition-title" > Note< / div >
< p > The < code > hostname< / code > parameter is used for SNI (Server Name Indication), which is required when connecting to servers that host multiple domains on the same IP address. It should match the domain name in the server's certificate.< / p >
< / div >
< div class = "admonition tip" >
< div class = "admonition-title" > Tip< / div >
< p > For most use cases, consider using the higher-level < code > http< / code > module which handles TLS connections, HTTP protocol details, and response parsing automatically.< / p >
< / div >
< / article >
< footer class = "page-footer" >
feat: add fswatch, sysinfo, and udp demo scripts plus reorder manual sidebar links
Add three new example scripts demonstrating the fswatch, sysinfo, and udp modules with file watching, system metrics, and UDP echo server/client patterns. Reorder the manual API sidebar navigation to list modules alphabetically, removing deprecated entries like websocket, tls, net, json, regex, jinja, os, signal, subprocess, sqlite, and timer while adding argparse, dataset, fswatch, and html.
2026-01-25 13:09:28 +01:00
< a href = "timer.html" class = "prev" > timer< / a >
< a href = "udp.html" class = "next" > udp< / a >
feat: add example scripts for argparse, bytes, dataset, html, markdown, uuid, wdantic, and web chat modules
Add comprehensive demo scripts showcasing the usage of multiple Wren modules including argument parsing, byte manipulation, in-memory dataset operations, HTML encoding/slugification, markdown-to-HTML conversion, UUID generation/validation, schema validation with wdantic, and a full web chat application with REST endpoints.
2026-01-24 23:40:22 +01:00
< / footer >
< / main >
< / div >
< script src = "../js/main.js" > < / script >
< / body >
< / html >