Skip to content

feat: SDK update for version 25.0.0#168

Merged
abnegate merged 6 commits into
mainfrom
dev
Apr 24, 2026
Merged

feat: SDK update for version 25.0.0#168
abnegate merged 6 commits into
mainfrom
dev

Conversation

@ArnabChatterjee20k
Copy link
Copy Markdown
Member

@ArnabChatterjee20k ArnabChatterjee20k commented Apr 20, 2026

This PR contains updates to the SDK for version 25.0.0.

What's Changed

  • Breaking: Added unsubscribe(), update(), and close() for Realtime subscription lifecycle.
  • Added: Added userPhone to the Membership model.
  • Updated: Updated X-Appwrite-Response-Format header to 1.9.2.

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 20, 2026

Greptile Summary

This PR upgrades the Web SDK to version 25.0.0, refactoring the Realtime subscription system from URL-parameter-based channel registration to a WebSocket message-based protocol (subscribe/unsubscribe frames) and switching from integer slot keys to client-generated UUIDs. The new Realtime service class gains a proper unsubscribe()/update()/close() lifecycle API, and userPhone is added to the Membership model.

  • P1 (src/client.ts line 823): The unsubscribe closure returned by Client.subscribe() removes the subscription client-side but never sends an unsubscribe frame to the server. Under the new message-based protocol the server keeps routing events for the removed subscription until the connection is closed or reconnected, silently leaking the server-side subscription. The Realtime service class's own unsubscribe() correctly calls sendUnsubscribeMessage — the equivalent is missing in Client.subscribe().

Confidence Score: 3/5

Not safe to merge — the Client.subscribe() unsubscribe path silently leaks server-side subscriptions under the new protocol.

One confirmed P1 regression: the unsubscribe closure in Client.subscribe() does not send an unsubscribe message to the server when the socket is open, causing the server to continue routing events for removed subscriptions. This is a behavioral correctness issue on the primary realtime code path introduced by this PR's protocol change.

src/client.ts — the unsubscribe closure returned by Client.subscribe() (lines 823-836) needs an explicit unsubscribe frame sent to the server.

Important Files Changed

Filename Overview
src/client.ts Major realtime refactor: subscriptions now use client-generated UUIDs and subscribe/unsubscribe WebSocket messages instead of URL params; the unsubscribe closure returned by Client.subscribe() does not send an unsubscribe message to the server (P1).
src/services/realtime.ts New subscription lifecycle API (unsubscribe/update/close) with UUID-based subscriptionIds and proper sendUnsubscribeMessage; dead Array.isArray branch in update() is unreachable; subscriptionId field typed optional when it is always required.
src/models.ts Added userPhone field to the Membership model as documented in the changelog.
package.json Version bumped to 25.0.0; aligns with package-lock.json, SDK headers, and README.
CHANGELOG.md 25.0.0 entry correctly documents the breaking subscription lifecycle additions, userPhone model field, and response-format header bump.

Reviews (5): Last reviewed commit: "chore: update Web SDK to 25.0.0" | Re-trigger Greptile

Comment thread src/client.ts Outdated
Comment thread src/services/realtime.ts Outdated
Comment thread src/services/realtime.ts Outdated
@ArnabChatterjee20k ArnabChatterjee20k changed the title feat: Web SDK update for version 24.2.0 feat: Web SDK update for version 25.0.0 Apr 23, 2026
Comment thread src/client.ts
Comment on lines 823 to 836
return () => {
this.realtime.subscriptions.delete(counter);
this.realtime.cleanUp(channelStrings, queryStrings);
this.realtime.subscriptions.delete(subscriptionId);
this.realtime.pendingSubscribes.delete(subscriptionId);
const stillUsed = new Set<string>();
this.realtime.subscriptions.forEach(sub => {
sub.channels.forEach(channel => stillUsed.add(channel));
});
this.realtime.channels.forEach(channel => {
if (!stillUsed.has(channel)) {
this.realtime.channels.delete(channel);
}
});
this.realtime.connect();
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Unsubscribe doesn't notify the server via the new protocol

The returned unsubscribe function deletes the subscription from local maps and calls connect(), but connect() only calls sendPendingSubscribes() when the socket is already OPEN — and pendingSubscribes was just cleared for this subscriptionId, so nothing is sent.

Under the old URL-parameter model, reconnecting with an updated channel list was enough to inform the server. Under the new message-based model the server must receive an explicit unsubscribe frame. Without it, the server continues routing events for the removed subscription for the lifetime of the connection; they are silently dropped client-side only after a reconnect removes the subscription from the re-subscription list.

The Realtime service class's unsubscribe() closure correctly calls sendUnsubscribeMessage([subscriptionId]) — the same call is missing here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its fine as the deprecated client.ts shouldn't do this

@ArnabChatterjee20k ArnabChatterjee20k changed the title feat: Web SDK update for version 25.0.0 feat: SDK update for version 25.0.0 Apr 23, 2026
@abnegate abnegate merged commit f904d86 into main Apr 24, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants