Skip to content

Commit 19463de

Browse files
Release - 4.20.0
1 parent b63f2d6 commit 19463de

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+154
-34
lines changed

CHANGELOG.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,67 @@
11
# Changelog
22

3+
## v4.20.0 (Sep 25, 2025)
4+
### **Improvements**
5+
6+
- Added `onConnectionDelayed` callback to `ConnectionHandler`
7+
A new callback method that is invoked when the server is overloaded. This callback provides information about the delay time before automatic reconnection. After the delayed time period, the SDK automatically initiates reconnection and triggers the callback sequence: `onReconnectStarted``onReconnectSucceeded`
8+
9+
```typescript
10+
sb.addConnectionHandler('connection-handler-key', new ConnectionHandler({
11+
onConnected: (userId: string) => {
12+
/** A callback for when SendbirdChat is connected. */
13+
},
14+
onReconnectStarted: () => {
15+
/** A callback for when SendbirdChat tries to reconnect. */
16+
},
17+
onReconnectSucceeded: () => {
18+
/** A callback for when connection is reestablished. */
19+
},
20+
onReconnectFailed: () => {
21+
/** A callback for when reconnection is failed. */
22+
},
23+
onDisconnected: () => {
24+
/** A callback for when SendbirdChat is disconnected. */
25+
},
26+
onConnectionDelayed: (retryAfterTime: number /* second */) => {
27+
/** A callback for when connection is delayed. */
28+
29+
// Example: Show user-friendly message
30+
// showNotification(`Server is busy. Reconnecting in ${retryAfterTime} seconds...`);
31+
}
32+
}));
33+
```
34+
35+
- Added `SendbirdErrorCode.DELAYED_CONNECTING` error code
36+
A new error code that is thrown when the server is overloaded and connection is delayed. Provides detailed information about the delay through the `error.detail` property.
37+
38+
```typescript
39+
try {
40+
await sb.connect(USER_ID, AUTH_TOKEN);
41+
} catch(error) {
42+
if (error.code === SendbirdErrorCode.DELAYED_CONNECTING) {
43+
console.log('error message', error.message);
44+
45+
// detail info
46+
const detailInfo = JSON.parse(error.detail);
47+
console.log('retryAfterTime', detailInfo.retry_after); // Delay time in seconds
48+
console.log('reasonCode', detailInfo.reason_code); // Server reason code
49+
console.log('message', detailInfo.message); // Detailed error message
50+
51+
// Handle delayed connection appropriately
52+
// The SDK will automatically retry after the specified delay time
53+
}
54+
}
55+
```
56+
57+
**Error Detail Properties:**
58+
- `retry_after`: The delay time in seconds before automatic reconnection
59+
- `reason_code`: Server-provided reason code for the delay
60+
- `message`: Detailed error message explaining the delay
61+
62+
- Fixed typing indicator persistence bug after `channel.refresh()`
63+
- Fixed a bug where messages below the channel's `messageOffsetTimestamp` were not properly filtered
64+
365
## v4.19.11 (Sep 22, 2025)
466
### **Improvement**
567
- Add `copilot_conversation_only` boolean parameter to filter copilot conversation channels

aiAgent.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cjs/aiAgent.cjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

cjs/feedChannel.cjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

cjs/groupChannel.cjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

cjs/index.cjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

cjs/lib/__bundle-048fab97.cjs

Lines changed: 2 additions & 0 deletions
Large diffs are not rendered by default.

cjs/lib/__bundle-0ef2dc04.cjs

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
var e=require("./__bundle-fefc0417.cjs"),s=require("./__bundle-711bd76e.cjs");class t extends e.APIRequestCommand{constructor({channelType:s,channelUrl:t,limit:n,token:i}){super(),this.method=e.APIRequestMethod.GET,this.path=`${e.getChannelApiPathByType(s)}/${encodeURIComponent(t)}/messages/parent_thread_message`,this.params=e.deundefined(e.undefineNullProps({limit:n,token:i}))}}class n extends e.APIResponseCommand{constructor(e,t){super(e,t),this.token=t.next,this.messages=t.messages.map((t=>s.parseMessagePayload(e,t)))}}class i extends e.ChannelDataListQuery{constructor(e,s,t,n){super(e,s,t,n),this._edge=""}_validate(){return super._validate()}load(){return e.__awaiter(this,void 0,void 0,(function*(){if(this._validate()){if(this._isLoading)throw e.SendbirdError.queryInProgress;if(this._hasNext){this._isLoading=!0;const{requestQueue:s}=e.Vault.of(this._iid),i=new t({channelType:this.channelType,channelUrl:this.channelUrl,token:this._edge,limit:this.limit}),a=yield s.send(i),{messages:r,token:d}=a.as(n);return this._edge=d,this._hasNext=!!d,this._isLoading=!1,r}return[]}throw e.SendbirdError.invalidParameters}))}}exports.ThreadedParentMessageListQuery=i;
1+
var e=require("./__bundle-048fab97.cjs"),s=require("./__bundle-6677d842.cjs");class t extends e.APIRequestCommand{constructor({channelType:s,channelUrl:t,limit:n,token:i}){super(),this.method=e.APIRequestMethod.GET,this.path=`${e.getChannelApiPathByType(s)}/${encodeURIComponent(t)}/messages/parent_thread_message`,this.params=e.deundefined(e.undefineNullProps({limit:n,token:i}))}}class n extends e.APIResponseCommand{constructor(e,t){super(e,t),this.token=t.next,this.messages=t.messages.map((t=>s.parseMessagePayload(e,t)))}}class i extends e.ChannelDataListQuery{constructor(e,s,t,n){super(e,s,t,n),this._edge=""}_validate(){return super._validate()}load(){return e.__awaiter(this,void 0,void 0,(function*(){if(this._validate()){if(this._isLoading)throw e.SendbirdError.queryInProgress;if(this._hasNext){this._isLoading=!0;const{requestQueue:s}=e.Vault.of(this._iid),i=new t({channelType:this.channelType,channelUrl:this.channelUrl,token:this._edge,limit:this.limit}),a=yield s.send(i),{messages:r,token:d}=a.as(n);return this._edge=d,this._hasNext=!!d,this._isLoading=!1,r}return[]}throw e.SendbirdError.invalidParameters}))}}exports.ThreadedParentMessageListQuery=i;

cjs/lib/__bundle-58380c84.cjs

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)