tickets
All repositories: gitoria
1.2 KB
// tests/events-client.hl — a PROGRAM subscribing to GET /api/events with hl:fetch's stream mode (ticket #26): prints// one line `EVENT <json>` per event and stops after EVENTS_MAX of them. tests/events.mjs runs it; it is also the// smallest example of a Hybriel subscriber.// EVENTS_URL=http://127.0.0.1:8790/api/events?project=alpha EVENTS_TOKEN=tkt_… EVENTS_MAX=2 ./bin/hybriel tests/events-client.hlimport { fetch, fetchAbort } from 'hl:fetch'import { env } from 'hl:proc'url = env('EVENTS_URL')max = env('EVENTS_MAX') != null ? toNumber(env('EVENTS_MAX')) : 1let seen = 0let rest = ''p = fetch(url, { headers = { 'Authorization' = 'Bearer ' + env('EVENTS_TOKEN') } stream = true tag = 'events' })console.log('OPEN')on p.chunk({ chunk }) {rest = rest + chunklet at = rest.indexOf('data: ')while (seen < max && at >= 0 && rest.indexOf(newline, at) > at) {end = rest.indexOf(newline, at)console.log('EVENT ' + rest.slice(at + 6, end))seen = seen + 1rest = rest.slice(end + 1)at = rest.indexOf('data: ')}if (seen >= max) { fetchAbort('events') }}on p.done({ status }) { console.log('DONE ' + status) }// the language has no escapes: a newline is written as itselfstatic newline = ""
Branches
Latest commits
- b487b05aRecord verified direct push protocol handoffmre
- 74e34cc3Verify encrypted push secrets and direct push retry semanticsmre
- a1ac5cd0Push subscription notices directly to signed HyperConductor chat endpointsmre
- d662ad27Remove superseded waker service for direct chat push protocolmre
- ff2e8701Finalize subscription build verification and handoff reportmre
- 54bc5fe1Harden delta relevance, overflow caps and retry verificationmre
- 8d8e2053Document subscription contract and exercise delta deliverymre
- fd23726aAdd subscription delta API and signed wake bridgemre
- c5d28fb5Tickets conductor: S51 startedmre
- fd6ca1e6Tickets conductor: brief 027 waker design, push-test projectmre
- e448e656Tickets conductor: STATUS #51mre
- 1c10857bTickets conductor: P51 eval, brief 027mre
- e725969dTickets conductor: #51 directionmre
- 1b5c63ddTickets conductor: P51 startedmre
- 9f13fbdaTickets conductor: brief 026 prioritymre
- acc477d9Tickets conductor: brief 026 + Vinzenz recommendationsmre
- 9233a734Tickets conductor: brief 026 completemre
- 5da589fdTickets conductor: brief 026 + Gitoria's answermre
- a3cd5329Tickets conductor: tickets#51 opened, brief 026 draftmre
- 6f6e5797Tickets conductor: STATUS wordingmre