Repository navigation
feat(platform)!: Socket messages page, and getSession with the socket path from the session - #313
Draft
amitbardos wants to merge 11 commits into
Draft
amitbardos wants to merge 11 commits into
amitbardos wants to merge 11 commits into
Conversation
🚀 Package Preview Available!Install this PR's preview build with npm: npm i @base44-preview/sdk@0.8.53-pr.313.e45e431Prefer not to change any import paths? Install using npm alias so your code still imports npm i "@base44/sdk@npm:@base44-preview/sdk@0.8.53-pr.313.e45e431"Or add it to your {
"dependencies": {
"@base44/sdk": "npm:@base44-preview/sdk@0.8.53-pr.313.e45e431"
}
}
Preview published to npm registry — try new features instantly! |
…by default The socketUrl and getSessionToken JSDoc link to the Create socket session endpoint page. sync-asyncapi.mjs documents production as its default source. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n endpoints The events are the wire protocol a socket session carries, so the docs list them in the Apps API's Socket sessions group, next to the endpoints that open the session. Dropping `events` from the category map keeps copy-docs-local from adding them to the Platform SDK Reference too. The page and its URL stay where they are, so existing links keep working. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
events-to-mdx.mjs now renders two pages from asyncapi.json:
- protocol/socket-messages: every message on the connection, both
directions, as it travels: the {room, data} envelope for the 18 the server
sends, and the plain room string for join and leave. The docs list it in
the Apps API's Socket sessions group, next to the session endpoints.
- events/builder-events: what the client adds. Which events reach onEvent,
and what it does with the rest, from its own eventNames, roomNotices and
sessionEndings. The fields live on the protocol page only.
Builder events is back in the Platform SDK Reference (events returns to the
category map). PlatformEvent's JSDoc links to the protocol page for payloads.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…l page
- The page lists the envelope's room and data as fields from the schema,
in place of the hand-written "Each message is { room, data }".
- Each message shows the examples the document publishes: a full
message.updated, session.ended with a null room, and the room string
join and leave send.
- The beta notice shows once at the top instead of on every message.
asyncapi.json is synced with sync:asyncapi from the document
base44-dev/apper#29607 serves, and gen:events regenerated the types:
TaskProgressed.event_type is now the five task values, and current/total
are integers.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The builder events page repeated what the callbacks' JSDoc already says (onSnapshot, both onError, PlatformEventMap) and listed the events a second time. events-to-mdx.mjs now renders only protocol/socket-messages, the one catalog of events and their payloads. onEvent links there, and events leaves the category map. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ple per event - Message format: the room and data envelope fields, with one short example beside them. - Events from the server: a linked index of all 18, then each event's description, its example and its data fields, in that order. - Messages from the browser: join and leave, the same way. asyncapi.json is re-synced from base44-dev/apper#29607, which now publishes an example for every message. PlatformSnapshot links to app.snapshot for its fields. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
- Each event shows its data fields, then its example. - The format section is "Event format": only what the server sends has the room and data envelope, join and leave send a plain string. - The index of events is gone. It repeated each event's first sentence, and Mintlify's own table of contents already lists the headings. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
PlatformSnapshot listed every field of app.snapshot's data again. As
`Snapshot & { room }` instead of an interface, TypeDoc renders only its
description and `room`, and the description links to app.snapshot for the
rest. appended-articles.json follows it to type-aliases/, so it stays on the
builder page.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ough builder.init() takes getSession, which returns the Create socket session body unchanged. The socket opens at the session's socket_url and socket_path on the first connect(), and moves when a renewed session has a different address. createPlatformClient() takes no options; socketUrl, getSessionToken and PlatformClientOptions are gone. An invalid session rejects connect() with session_unavailable. Version 0.2.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
amitbardos
force-pushed
the
amitb/platform-asyncapi-sync
branch
from
October 11, 2026 12:41
bb9a3d5 to
10d8bae
Compare
PlatformSnapshot is an interface extending Snapshot instead of the
intersection Snapshot & { room }, so the reference lists status,
messages, queue and room instead of "Snapshot & object". SocketSession
joins it under Type Definitions with the same field layout.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
0.1.0 exported Base44PlatformClient with serverUrl, so the before snippet uses that. The event type renames from the AsyncAPI codegen are listed old to new. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #312. Merge that first; GitHub then retargets this PR to
main.Two parts, in separate commits so they can be reviewed apart. The weekly AsyncAPI sync workflow moved to #318, which waits for the backend deploy. #317 is folded in here and closed.
1. Socket messages page and JSDoc links (
4a0a781…c8db94c)events-to-mdx.mjsrenders onlyprotocol/socket-messages: every message on the connection in both directions, the{ room, data }envelope as fields, and the examples the document publishes. The builder events page is gone, since the callbacks' JSDoc already says how the client delivers each message.onEventlinks to the protocol page, which the docs list beside the session endpoints (base44-dev/mintlify-docs#2479).protocolisn't in the category map, socopy-docs-localkeeps it out of the Platform SDK nav.asyncapi.jsonis synced withsync:asyncapifrom the document base44-dev/apper#29607 serves, andgen:eventsregenerated the types.TaskProgressed.event_typeis now the five task values, andcurrent/totalare integers./api-reference/create-socket-session.2.
getSessionand the socket path from the session (10d8bae, breaking, 0.2.0)The browser passes one function instead of
socketUrlandgetSessionToken, and the socket path comes from the session instead of the hard-coded/ws/socket.io/.builder.init({ getSession, onError }):getSession: () => Promise<SocketSession>, whereSocketSessionis{ session_token, socket_url, socket_path }. Other keys (session_id,expires_in) are ignored.getSessionis called everywheregetSessionTokenwas called before: the first connect, renewal aftersession.endedwith reasonexpired, and the single renewal after aconnection_deniedon a cached token. The 20-second timeout and the cancellation inauthenticate()are unchanged.connect(), because the address is known only after the first session. Transport reconnects keep using the cached session.socket_urlorsocket_path, the SDK doesn't call the old socket's auth callback. It removes the old socket's listeners, disconnects it, opens a socket at the new address, and rejoins every active subscription.socket_urlmust be an HTTP(S) origin with no credentials, path, query or fragment (the same check as before).socket_pathmust be an absolute path with no query or fragment, and can't start with//.createPlatformClient()takes no arguments. No options are left. TypeScript callers that still pass{ socketUrl, getSessionToken }get a compile error instead of having the values silently ignored. An optional parameter can be added later without a breaking change.PlatformClientOptionsis removed.session_unavailable, whether the token, the URL or the path is invalid.connect()rejects with it andonErrorreceives it. NoTypeErroris thrown. The code already meant that the session endpoint gave the SDK nothing usable.CHANGELOG.md. JSDoc, examples,README.md, unit, type and package tests are updated.SocketSessionis listed on the builder reference page.Tests
PATH=/opt/homebrew/bin:$PATH npm testinpackages/platform:npm run check:eventsreportsbuilder.events.generated.ts is up to date.npm run create-docs, run after the tests, writes 20 messages toprotocol/socket-messages.mdx.npm run lintis clean.New unit tests cover: the path taken from the session, extra keys in the body ignored, renewal at a new address moving the socket and rejoining both subscriptions, a failed renewal, a late session after
close(), and 11 invalid bodies.Needs attention
package.jsonis already at 0.2.0, somanual-publish.ymlwithversion: 0.2.0fails ("Version not changed"), and withminorit would publish 0.3.0. Either add--allow-same-versionto the workflow, or setpackage.jsonback to 0.1.0 and publish withminor.mainbetween the two merges.🤖 Generated with Claude Code