tickets
All repositories: gitoria
4.4 KB
\* hl:http1 — the native WebSocket server. Subclass it (`inheritNativeWebSocketServer`) and answer the declared events below; eachconnected peer arrives as a WsClient (send/ping/close). AUTO-LISTEN: thefile root IS the constructor and ends with listen(), so`new NativeWebSocketServer(port = 8888)` serves immediately. *\/* Mission 064 (decision D9): the h1 plugin performs the RFC 6455 Upgrade/101handshake and framing (shared core plugins/http/ws_common.zig); thiswrapper maps the native event stream onto on/emit, mirroringNativeHttpServer. A SUBCLASS does not inherit this run body and callslisten() from its own root. */\* A peer completed the upgrade and is connected. *\emit connect(WsClient client \\ the new peer — send/ping/close)\* A complete text (or binary) message arrived from a peer. *\emit message(WsClient client \\ who sent itString data \\ the message payload)\* The peer answered a client.ping(). *\emit pong(WsClient client \\ who answered)\* A connection ended — the peer is already unregistered. *\emit close(WsClient client \\ who left)\* OPTIONAL: plain HTTP answered on the same port, exactly asNativeHttpServer's request. *\emit request(Hybrid req \\ method, path, headers, body, bytes, params, respond)Number port = 8080 \\ the port listen() bindsString host = "0.0.0.0" \\ the interface to bindNumber threads = 4 \\ I/O worker threadsNumber maxBody = 20971520 \\ largest request body read, bytes (default 20 MiB); over it: 413, connection closedBoolean wsCheckOrigin = false \\ refuse an upgrade whose Origin is foreign (not the Host, not in wsOrigins) with 403 before the 101; no Origin = allowedString wsOrigins = "" \\ extra allowed origins, comma-separatedBoolean listening = false \\ true after a successful bindHybrid clients = {} \\ live WsClients by connection idNumber #srcId = 0Number #wsSrcId = 0\* Bind the configured port and start the WebSocket engine (idempotent). *\listen() {if (listening == true) {return null}srv = __native("http1.create_server", port, host, "", "", threads, maxBody, wsCheckOrigin, wsOrigins)if (srv == null) {// A REFUSAL, NOT PROSE (mission 286) — same reason as NativeHttpServer's.hlError("hl:http1: listen() failed: could not bind port " + port + " on " + host + " — the port is already taken. The line just above, 'bind() failed on port " + port + "', names the process holding it: stop that process, or start this app on another port (--port N, or HL_PORT=N)")}wsev = __native("http1.ws_events")listening = true#srcId = __native("eventloop.register", srv, "request")#wsSrcId = __native("eventloop.register", wsev, "wsEvent")}\* One text frame to EVERY connected peer; answers how many received it. *\broadcast(String text \\ the frame to send) {return __native("http1.ws_broadcast", text)}\* Stop this server: both event sources retired, workers joined, listenerclosed — the port is free again. Answers false when not listening. *\close() {if (listening == false) {return false}listening = false__native("eventloop.unregister", #srcId)__native("eventloop.unregister", #wsSrcId)return __native("http1.close", port)}// Raw native events ({ kind, id, data, binary, code }) re-emitted as the// documented surface — emit is the universal primitive.on wsEvent(ev) {key = "c" + ev.idif (ev.kind == "connect") {client = new WsClient(ev.id, ev.cookie, ev.host != '' ? ev.host : null, headerHash(ev.headers), ev.ip != '' ? ev.ip : null, ev.secure) // the upgrade's cookie, host and headers ride with the connection (creator, 2026-09-12; tickets #74, #105)clients[key] = clientemit connect(client)}if (ev.kind == "message") {client = clients[key]if (client != null) {emit message(client, ev.data)}}if (ev.kind == "pong") {client = clients[key]if (client != null) {emit pong(client)}}if (ev.kind == "close") {client = clients[key]clients[key] = nullif (client != null) {emit close(client)}}}// The upgrade's headers arrive as `name: value` lines (names already lowercase);// a connection is handed them as a hash (ticket #105).headerHash(lines) {let nl = ""let out = {}if (lines == null || lines == '') { return out }for (line of lines.split(nl)) {let colon = line.indexOf(': ')if (colon > 0) { out[line.slice(0, colon)] = line.slice(colon + 2) }}return out}// Run body: bind the configured port (idempotent, like NativeHttpServer).listen()
Branches
Latest commits
- 6372b06dTickets conductor: worker port slotmre
- 836af31cTickets conductor: token pathsmre
- b03f11b6Tickets conductor: CONDUCTOR.md (project part), short STATUS.md, old STATUS to archive/2026-10-31mre
- a4123831tickets#42: the /connect and /login/callback error pages are app pages: the function routes redirect to /connect/failed/<code> and /login/failed/<code> (components/problem.hl, sentences in lib/problems.hl), htmlPage and its hand-written stylesheet are gone; gate tests/error-pages.mjsmre
- cefc7b4atickets: a startup error prints its message before exit 1 (hybriel#247)mre
- 99bd6570tickets: lib/migrate.hl writes no table of another topic any more: projects.hl rewriteSlug / addProjectNamed / hasMembers, tickets.hl moveToProject / ticketRecords / ticketRecordsOf, events.hl renameStates / eventRecords / eventRecordsOf; the migration calls them (tickets#47)mre
- b57161e3tickets: the markup names its own rules (Style.pMessage, Style.olTickets, ...) instead of hand-written class strings that copy a stylesheet rule; the shared bodies sit in lib/looks.hl (tickets#38)mre
- f767b24dtickets: 111 needless let became plain declarations (3 in ticket.hl, ticket_list.hl, comments.hl and 108 never-reassigned, not captured loop-body ones); the 212 really reassigned lets stay (tickets#44)mre
- 16c0d3b5tickets: the modal window is phone first: the full-screen sheet is the base rule, the centred window sits in the min-width 60rem block (tickets#39)mre
- 090ee809tickets: every component's styles in its own nested Style {} block; styles.hl keeps only the theme inherit, the accent and the site-wide rules (tickets#36)mre
- d395763ftickets: ident-access gate ports 8769/8768 (8797 is taken on loreana)mre
- afb9a403tickets: an ident access key (Authorization: Bearer idt_…) works in the API (ident#27 app side): lib/ident-access.hl copied from components, read keys GET only, ident down 503; gate tests/ident-access-tickets.mjsmre
- 48c1ba79tickets: md-paste-files gate with the file manager casesmre
- f04afc43tickets: MdEditor from components 59704ce (a file manager copy still attaches, pipe rows, tickets#49)mre
- 06599fa0tickets: MdEditor from components b0f1ec2 (a clipboard with text always pastes the text, tickets#49); real Ctrl+V gatemre
- 2e1b116ftickets: re-vendor Hybriel master acaceaf3 (framework ec8d6c1d): plugins/web patch queue while a page is built, anonymous session cookies refresh; gate waits for the comment editors to draw (W174) and clicks the form editor when it stands still; security gate: main's code runs on its own binary, lazy-session cookie checksmre
- 361bc0fetickets: re-vendor Hybriel 7a684920 (WIP, not deployed); on Error exits 1 at startup; migrate passes its log by reference; gate checks follow lazy sessions and the 413 refusalmre
- 8a69999cident#28: /login/callback never signs out the session it finds; a valid code puts the user on the same sessionmre
- 337e9b21tickets#37: a comment's files are open to everyone who can read the commentmre
- 1800600ftickets: write the standby service out in full so the boot gate can read the main servicemre