sse

Generated by tinox doc

tinox.core.sse, split out of the bundled stdlib as a standalone tinox-central package.

Event stream

import tinox.core.sse

class Main
{
    fnc main() -> Int32
    {
        let srv: Int64 = SseServer::listen(8080)
        let conn: Int64 = SseServer::accept(srv)
        if (conn > 0)
        {
            Sse::sendEvent(conn, "message", "hello")
            Sse::sendComment(conn) // keepalive
            Sse::close(conn)
        }
        return 0
    }
}

class Sse

Methods

fn handshake(conn: Int64) → Bool
fn sendEvent(conn: Int64, event: String, data: String) → Nothing
fn sendComment(conn: Int64) → Nothing
fn close(conn: Int64) → Nothing

class SseServer

Methods

fn listen(port: Int64) → Int64
fn accept(srv: Int64) → Int64
fn listenTls(port: Int64, certPath: String, keyPath: String) → Int64
fn acceptTls(srv: Int64) → Int64