Releases: sendbird/sendbird-chat-sdk-javascript
Releases · sendbird/sendbird-chat-sdk-javascript
v4.20.0
Improvements
- Added
onConnectionDelayed
callback toConnectionHandler
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
sb.addConnectionHandler('connection-handler-key', new ConnectionHandler({
onConnected: (userId: string) => {
/** A callback for when SendbirdChat is connected. */
},
onReconnectStarted: () => {
/** A callback for when SendbirdChat tries to reconnect. */
},
onReconnectSucceeded: () => {
/** A callback for when connection is reestablished. */
},
onReconnectFailed: () => {
/** A callback for when reconnection is failed. */
},
onDisconnected: () => {
/** A callback for when SendbirdChat is disconnected. */
},
onConnectionDelayed: (retryAfterTime: number /* second */) => {
/** A callback for when connection is delayed. */
// Example: Show user-friendly message
// showNotification(`Server is busy. Reconnecting in ${retryAfterTime} seconds...`);
}
}));
- Added
SendbirdErrorCode.DELAYED_CONNECTING
error code
A new error code that is thrown when the server is overloaded and connection is delayed. Provides detailed information about the delay through theerror.detail
property.
try {
await sb.connect(USER_ID, AUTH_TOKEN);
} catch(error) {
if (error.code === SendbirdErrorCode.DELAYED_CONNECTING) {
console.log('error message', error.message);
// detail info
const detailInfo = JSON.parse(error.detail);
console.log('retryAfterTime', detailInfo.retry_after); // Delay time in seconds
console.log('reasonCode', detailInfo.reason_code); // Server reason code
console.log('message', detailInfo.message); // Detailed error message
// Handle delayed connection appropriately
// The SDK will automatically retry after the specified delay time
}
}
Error Detail Properties:
-
retry_after
: The delay time in seconds before automatic reconnection -
reason_code
: Server-provided reason code for the delay -
message
: Detailed error message explaining the delay -
Fixed typing indicator persistence bug after
channel.refresh()
-
Fixed a bug where messages below the channel's
messageOffsetTimestamp
were not properly filtered
v4.19.11
Improvement
- Add
copilot_conversation_only
boolean parameter to filter copilot conversation channels - Add
copilot_support_channel_url
string parameter for copilot support channel identification - Update
AIAgentGroupChannelListParams
interface and default values - Update
LoadAIAgentMyGroupChannelListRequestCommand
to handle new parameters
v4.19.10
Improvement
- Fixed ping interval being incorrectly converted during session refresh, causing ping frequency to change from 15 seconds to ~4 hours
v4.19.9
v4.19.8
Improvement
- Fixed a bug in parsing
data
andcustomType
properties inFileMessage
v4.19.7
Improvement
- Fixed a bug that prevented fetching all information stored in the memory cache for
parent messages
v4.19.6
Improvement
- Fixed a bug that
loadMore()
may have unfiltered channels
v4.19.5
Improvement
- Added
createMyGroupChannelListQuery
,getMyGroupChannelChangeLogsByToken
,getMyGroupChannelChangeLogsByTimestamp
andgetUnreadMessageCount
methods to AI Agent module - Added
getContextObject
,updateContext
andpatchContext
methods toGroupChannel
v4.19.4
Improvement
- Added summary field to Conversation class
v4.19.3
Improvement
- Fixed a bug where
sb.connect()
would not correctly throw the error received from the server