tracker
All repositories: gitoria
4.0 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 threadsBoolean 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)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)) // 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
- mainmain branch
Latest commits
- 0553b51ftracker#19 (mission 066): franchises and timelines — tables, /franchises, /franchises/<slug>, /timelines/<slug> (Timeline | Release sort, series by last episode), the Prequel | Timeline | Sequel widget with the franchise above, the creator's editor, TMDB collection seed in the app (resumes, paced); gate tests/franchises.mjs 48/0 + browser.mjs 266/0, tests/realdata-066.mjs, docs/franchises.md, README + STATUSmre
- fa1f9dfatracker#29 (mission 063): unwatched check muted grey outline + check (accent only on hover), watched stays solid — no code regression, the accent outline read as ticked; gate checks real checks visibly (computed style + screenshot pixel) on /my/unwatched, show, movie, /my/movies; gate 266, tests/realdata-063.mjs, README + STATUSmre
- d8b12d67tracker#27 (mission 060): short ids for movies, series and persons — old 702 kept (data/old-short-ids.json), new random [a-z0-9]{5} unique across both, claimed at creation, background backfill (resumes), shown under poster/photo, /<shortId> → 301; gate 259, tests/realdata-060*, README + STATUSmre
- f14db671tracker#22-#25 (mission 058): episode air dates, season check = all episodes watched, movie watched check (+ /my/movies count), /genres/<genre> pages (movies + series, newest first, paginated); gate 238, tests/realdata-058.mjs, README + STATUSmre
- 1704ec45tracker#17 (mission 057): season caret down/up, skeleton rows while a season loads, sessionless showSeasonEpisodes face (no page re-mount), client-only close; gate 214, tests/realdata-057.mjs, README + STATUSmre
- f2fe3e36mission 056: README + STATUS (merge, fixes, Hybriel 8590df63, real-data check), tests/realdata-056.mjs, tools/check-public-slugs.hlmre
- f40c250emission 056: re-vendor hybriel master 8590df63 (#121, #122); an adult title's page is Not found for non-followers; gate: leave the page before stopping the servermre
- 2b7fdd6cmission 056: signed-out header one row on phones ("Log in", nowrap), backfill skips adult titles' posters, gate checksmre
- 2c53d5efMerge branch 't16-person' (tracker#16 person pages) into main; filmography shows only public titles (054 adult flag), gate race fix (backfill start line)mre
- c171227emission 054: hide adult/unknown titles from the public lists and the search; in-app adult-flag backfill (TMDB details + poster per title, resumes), gate + real-data proofmre
- 139fafd8tracker#16: short bio (4 lines, click = all), real-data check script, README + STATUSmre
- 93be9476tracker#16: person pages /person/<slug> with the filmography fetched from TMDB on the first visit (step by step), gatemre
- 47a3cae6STATUS: mission 053 merge commit idsmre
- dcc5eecaMerge branch 't14-search'mre
- 03edc783Merge branch 't15-tvmaze'mre
- 71b46345tracker#15: numbering check by date or title, placeholder titles in other languages, docs + real-data proofmre
- 6bb2daf1tracker#13: homepage (tiles, intro, latest movies/shows), /shows, /movies/page/N, /my/movies; lists cached in memorymre
- b8bd1157tracker#14: README + STATUS (search, real-data numbers, gate, merge notes)mre
- 65c694a8tracker#14: search — header magnifier, /search/<text> (in-memory word-prefix index over titles + people), Fetch from web (TMDB search/multi, ours left out), Add = import via syncShow; gate +25 checks, real-data scriptmre
- 34f2c15btracker#15: TVmaze merge in the sync (gaps only: new episodes/seasons, empty titles/air dates; numbering check), fake TVmaze episodes + gatemre