gitoriaLog in with ident

gitoria

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit090a20c6090a20c6mission 002 (code order) 2/4: one lib/ file per topic — git.hl split into git (calls, branches, init, temp folder) / homepage / code / pulls / releases (+ git-helpers: paths, ids, |||PR/|||RL markers); repos-helpers, tickets-helpers, transport-helpers; util.hl = localtime + env, storage dir, addresses, lists, text checks, one newest-first sort (was 3 copies); the function routes out of project.hl into lib/api.hl (thin; plumbing in api-helpers.hl), sshgate.hl folded into api.hl + sshkeys.hl keyLine + repos.hl mayPush; 'Make main' and the merge answer out of the faces (code.hl makeMain, pulls.hl pullsView), one login helper (users.hl userOfLoginCode); project.hl is the map. Session-writing routes get &req + &server.sessions. gates 200/0, 46/0, 44/0; real-data identical except /login/failed now shows the parked reason for a browser that already had a session (the old copy-of-req lost it)mre090a20c6/plugins/http1/web_socket_client.hl

3.3 KB

  1. \* hl:http1 — the OUTGOING WebSocket client (ticket #109). Subclass it
  2. (`inherit WebSocketClient`) and answer `on open()`, `on message(text)`
  3. and `on close(code)`. AUTO-CONNECT: the file root IS the constructor and
  4. its last statement is connect(), so `new WebSocketClient(url = "ws://…")`
  5. dials immediately, mirroring NativeHttpServer's AUTO-LISTEN. `wss://`
  6. uses the same client TLS as hl:fetch: the system trust store, hostname
  7. verification always on, and `caFile` names an EXTRA anchor for a
  8. self-signed test fixture (never a replacement for the system store). *\
  9. /* Ping/pong is entirely automatic (mission 091's liveness sweep, mirrored
  10. here): a quiet connection is pinged and dropped if the pong doesn't
  11. answer in time, and any inbound ping is answered with a pong — neither
  12. ever reaches `.hl`, the protocol requires them and they are not
  13. application information. RECONNECT IS NEVER AUTOMATIC: a dropped
  14. connection reaches you as exactly one `close` event and nothing here
  15. dials again on its own — call connect() again yourself, e.g. from your
  16. own `on close`, if you want a reconnect policy. */
  17. \* The connection is open and ready for send(). *\
  18. emit open()
  19. \* One complete text (or binary) message arrived from the peer. *\
  20. emit message(
  21. String data \\ the message payload
  22. )
  23. \* The connection ended — at most one `open` ever preceded it (a connection
  24. that never opened still gets exactly one `close`: 1006 for a dial that
  25. never reached a peer, 1002 for a handshake the peer answered but got
  26. wrong). *\
  27. emit close(
  28. Number code \\ the WebSocket close code (RFC 6455 §7.4)
  29. )
  30. String url = null \\ "ws://host[:port][/path]" or "wss://…"
  31. Hybrid headers = {} \\ extra headers on the Upgrade request
  32. String caFile = null \\ wss:// only — an extra trust anchor, exactly hl:fetch's field of the same name
  33. Boolean connected = false \\ true between `open` and `close`
  34. Number #id = 0
  35. Number #srcId = 0
  36. \* Dial the configured url (idempotent — a connect() while already dialling
  37. or open is a no-op: false). Ping/pong needs no call here; it is
  38. automatic — see above. *\
  39. connect() {
  40. if (#id != 0) {
  41. return false
  42. }
  43. id = __native("http1.wsc_connect", url, { headers = headers; caFile = caFile; })
  44. if (id == null) {
  45. hlError("hl:http1: WebSocketClient connect() needs a ws:// or wss:// url — got " + url)
  46. }
  47. #id = id
  48. ev = __native("http1.wsc_events", id)
  49. #srcId = __native("eventloop.register", ev, "wscEvent")
  50. return true
  51. }
  52. \* One text frame to the peer; false when not open. *\
  53. send(
  54. String text \\ the frame to send
  55. ) {
  56. return __native("http1.wsc_send", #id, text)
  57. }
  58. \* Close this connection; `on close` still fires once the peer's echo (or a
  59. timeout) completes the handshake. False when not open. *\
  60. close() {
  61. return __native("http1.wsc_close", #id)
  62. }
  63. // Raw native events ({ kind, data, code }) re-emitted as the documented
  64. // surface — emit is the universal primitive (mirrors NativeWebSocketServer).
  65. on wscEvent(ev) {
  66. if (ev.kind == "open") {
  67. connected = true
  68. emit open()
  69. }
  70. if (ev.kind == "message") {
  71. emit message(ev.data)
  72. }
  73. if (ev.kind == "close") {
  74. connected = false
  75. __native("eventloop.unregister", #srcId)
  76. #id = 0 // connect() again is allowed from here — reconnect is the caller's choice, never automatic
  77. emit close(ev.code)
  78. }
  79. }
  80. // Run body: the constructor's last act — dial the configured url.
  81. connect()

Branches

Latest commits

  • 090a20c6mission 002 (code order) 2/4: one lib/ file per topic — git.hl split into git (calls, branches, init, temp folder) / homepage / code / pulls / releases (+ git-helpers: paths, ids, |||PR/|||RL markers); repos-helpers, tickets-helpers, transport-helpers; util.hl = localtime + env, storage dir, addresses, lists, text checks, one newest-first sort (was 3 copies); the function routes out of project.hl into lib/api.hl (thin; plumbing in api-helpers.hl), sshgate.hl folded into api.hl + sshkeys.hl keyLine + repos.hl mayPush; 'Make main' and the merge answer out of the faces (code.hl makeMain, pulls.hl pullsView), one login helper (users.hl userOfLoginCode); project.hl is the map. Session-writing routes get &req + &server.sessions. gates 200/0, 46/0, 44/0; real-data identical except /login/failed now shows the parked reason for a browser that already had a session (the old copy-of-req lost it)mre
  • 110c2799mission 002 (code order) 1/4: .hl files out of the root — lib/ (api, git, localtime, markdown, repos, sshgate, sshkeys, tickets, tokens, transport, users), components/styles.hl; jsoncheck.hl removed (imported nowhere); import paths only. gates 200/0, 46/0, 44/0; real-data reads + writes identicalmre
  • fdfb4b1bgitoria: Hybriel master 06617221 (plugin allocators 3a781359 + 413f60e4, mpackdb 2cb7ae5e, http1 773de63e); gates 200/0, 46/0, 44/0mre
  • 5b46ac84antcolony#40: LOG.md — missions 069/072 are antcolony missions (report paths on Byrodin)mre
  • 5602ff41gitoria: Hybriel master 190aa11d (fc838894 GC correctness, #127 mountKids by reference, #126, #48) — tracker README flat; gates 200/0, 46/0, 44/0mre
  • e85eaf01gitoria: 069 round 2 — hybriel 1a096ad3 not adopted (Markdown SSR still grows); browser gate waits for the server-side logout before restartmre
  • 09ce4f3fgitoria: mission 069 re-vendor hybriel 8efba065 stopped (big SSR pages grow + slow down); lambda audit clean; old vendor keptmre
  • 3dc43108antcolony#40: mission references point to the moved missionsmre
  • 8d9450fdantcolony#40: history (LOG.md), worker briefs (missions/) and reports moved here from antcolony, numbered per project; old numbers in antcolony docs/mission-map.mdmre
  • 205d5fe4gitoria: Hybriel master ff51cf46; ssh keys/tokens no double rows (session sync); gates follow #20mre
  • 9b27cb26gitoria#21: installable app (manifest, service worker, offline start page), own iconmre
  • 68dcb603deploy.sh: back up live storage/.sessions/.env before every deploy (newest 5 kept)mre
  • e2deed6dgitoria#20: "Add code" only on the Code page of an empty repository, no collapsiblemre
  • 8bb97ffddeploy.sh: never send .git or .gitignore to Byrodinmre
  • fd981932State of 2026-09-27; bin/ no longer tracked (Hybriel commit is in README)mre
  • 4a2d7125initial commitmre