Skip to content

v1.x to v2.0 Migration

This page covers breaking changes introduced in v2.0.0 (released 2025-02-07). The last v1.x release was v1.7.2 (2024-08-08).

Platform scope

Most breaking changes in v2.0.0 affect the JavaScript SDK only. Native (iOS/Android) breaking changes are called out explicitly.

Chat API Deprecation

The Chat API is deprecated and will be removed in a future release. Chat-related breaking changes (e.g. ChannelType renamed to MemberChannelType, MemberChannelType PascalCase keys, deprecated Chat function signatures removed) are not documented here. Do not build new applications using the Chat API.

Version Mapping

v1.x (last)v2.x (first)
1.7.22.0.0

Enum Key Renames (JS)

All enum keys changed from their v1.x casing to PascalCase. The underlying values are unchanged — only the keys you use to access them differ.

HangupReason

v1.x Keyv2.0 KeyValue (unchanged)
REMOTE_HANGUPRemoteHangup'REMOTE_HANGUP'
REMOTE_REJECTRemoteReject'REMOTE_REJECT'
REMOTE_NO_ANSWER_TIMEOUTRemoteNoAnswerTimeout'REMOTE_NO_ANSWER_TIMEOUT'
LOCAL_HANGUPLocalHangup'LOCAL_HANGUP'
MEDIA_TIMEOUTMediaTimeout'MEDIA_TIMEOUT'

LegStatus

v1.x Keyv2.0 KeyValue (unchanged)
RINGINGRinging'RINGING'
ANSWEREDAnswered'ANSWERED'
COMPLETEDCompleted'COMPLETED'

CallDisconnectReason

v1.x Keyv2.0 KeyValue (unchanged)
networkChangeNetworkChange'networkChange'

CancelReason

Keys were already PascalCase in v1.x — no change required.

KeyValue
RemoteCancel'RemoteCancel'
RejectedElsewhere'RejectedElsewhere'
RemoteTimeout'RemoteTimeout'
AnsweredElsewhere'AnsweredElsewhere'

VoiceChannelType

v1.x Keyv2.0 KeyValue (unchanged)
appApp'app'
phonePhone'phone'
sipSip'sip'
websocketWebsocket'websocket'

VonageErrorType

v1.x Keyv2.0 KeyValue (unchanged)
CS_ERRORCsError'CS_ERROR'
SESSION_ERRORSessionError'SESSION_ERROR'
NETWORK_ERRORNetworkError'NETWORK_ERROR'
INTERNAL_ERRORInternalError'INTERNAL_ERROR'
UNKNOWN_ERRORUnknownError'UNKNOWN_ERROR'

SessionErrorReason

v1.x Keyv2.0 KeyValue (unchanged)
TRANSPORT_CLOSEDTransportClosed'TRANSPORT_CLOSED'
PING_TIMEOUTPingTimeout'PING_TIMEOUT'
EXPIRED_TOKENExpiredToken'EXPIRED_TOKEN'

Example

typescript
// v1.x
if (reason === HangupReason.REMOTE_HANGUP) { /* ... */ }
if (error.type === VonageErrorType.CS_ERROR) { /* ... */ }
if (channel === VoiceChannelType.app) { /* ... */ }

// v2.0
if (reason === HangupReason.RemoteHangup) { /* ... */ }
if (error.type === VonageErrorType.CsError) { /* ... */ }
if (channel === VoiceChannelType.App) { /* ... */ }

CSErrorCodes & SessionErrorCodes: Object to Enum (JS)

In v1.x, CSErrorCodes and SessionErrorCodes were re-exports of Kotlin objects with SCREAMING_SNAKE_CASE getter properties. In v2.0, they are proper TypeScript enum-style const objects with PascalCase keys, consistent with all other SDK enums.

CSErrorCodes

v1.x Keyv2.0 KeyValue (unchanged)
CONVERSATION_DUPLICATE_NAMEConversationDuplicateName'CONVERSATION_DUPLICATE_NAME'
MEMBER_ALREADY_JOINEDMemberAlreadyJoined'MEMBER_ALREADY_JOINED'
MEMBER_ALREADY_INVITEDMemberAlreadyInvited'MEMBER_ALREADY_INVITED'
CONVERSATION_NOT_FOUNDConversationNotFound'CONVERSATION_NOT_FOUND'
MEMBER_NOT_FOUNDMemberNotFound'MEMBER_NOT_FOUND'
USER_NOT_FOUNDUserNotFound'USER_NOT_FOUND'
INVALID_CURSORInvalidCursor'INVALID_CURSOR'
VALIDATION_FAILValidationFail'VALIDATION_FAIL'
CONVERSATION_MAX_NUMBER_OF_MEMBERSConversationMaxNumberOfMembers'CONVERSATION_MAX_NUMBER_OF_MEMBERS'
CUSTOM_DATA_OVERALL_LIMIT_EXCEEDEDCustomDataOverallLimitExceeded'CUSTOM_DATA_OVERALL_LIMIT_EXCEEDED'

SessionErrorCodes

v1.x Keyv2.0 KeyValue (unchanged)
TIMEOUTTimeout'TIMEOUT'
EXPIRED_TOKENExpiredToken'EXPIRED_TOKEN'
EMPTY_TOKENEmptyToken'EMPTY_TOKEN'
FORCED_DISCONNECTForcedDisconnect'FORCED_DISCONNECT'
INTERNAL_FAILUREInternalFailure'INTERNAL_FAILURE'
NO_ACTIVE_SESSIONNoActiveSession'NO_ACTIVE_SESSION'
ALREADY_ACTIVE_SESSIONAlreadyActiveSession'ALREADY_ACTIVE_SESSION'
INVALID_TOKENInvalidToken'INVALID_TOKEN'
INVALID_USERInvalidUser'INVALID_USER'
AUTHORIZATION_ERRORAuthorizationError'AUTHORIZATION_ERROR'
INVALID_SESSIONInvalidSession'INVALID_SESSION'
MAX_OPEN_SESSIONSMaxOpenSessions'MAX_OPEN_SESSIONS'
INVALID_SOCKET_TRANSPORTInvalidSocketTransport'INVALID_SOCKET_TRANSPORT'
CLIENT_DISCONNECTClientDisconnect'CLIENT_DISCONNECT'
PING_TIMEOUT_DISCONNECTPingTimeoutDisconnect'PING_TIMEOUT_DISCONNECT'
TRANSPORT_CLOSED_DISCONNECTTransportClosedDisconnect'TRANSPORT_CLOSED_DISCONNECT'

Example

typescript
// v1.x (Kotlin object re-export with SCREAMING_SNAKE getters)
if (code === CSErrorCodes.CONVERSATION_NOT_FOUND) { /* ... */ }
if (code === SessionErrorCodes.EXPIRED_TOKEN) { /* ... */ }

// v2.0 (TypeScript enum-style const object with PascalCase keys)
if (code === CSErrorCodes.ConversationNotFound) { /* ... */ }
if (code === SessionErrorCodes.ExpiredToken) { /* ... */ }

Removed Deprecated Functions

Logging Functions (All Platforms)

Removed FunctionPlatform
setDefaultLoggingLevel()All
setVonageClientLoggingLevel()JS

Set the logging level at client initialization instead. See Logging and diagnostics for configuration details and examples.

Push Token Registration (iOS)

Removed FunctionReplacement
registerDevicePushToken()registerDeviceVoipToken()

Fixed Types (JS)

These are bug fixes but may break code that was working around the previous incorrect types:

  • VonageError.type — previously exposed a mangled Kotlin type string; now returns a proper VonageErrorType union string
  • on('sessionError') callback reason — previously exposed a mangled Kotlin type string; now returns a proper SessionErrorReason union string

If your code was comparing these against raw strings or handling the mangled output, update it to use the enum objects:

typescript
// v2.0 — correct usage
client.on('sessionError', (reason) => {
  if (reason === SessionErrorReason.ExpiredToken) {
    // refresh token
  }
});

Kotlin 2.0.0 Upgrade

The core library was updated from Kotlin 1.9.x to Kotlin 2.0.0 (with 1.9.21 API compatibility). If you consume the Android SDK and have Kotlin version constraints in your Gradle build, ensure they are compatible with Kotlin 2.0.0.

Built with VitePress.