Skip to main content
Skip table of contents

VMSPusherApi. Android

Uses com.pusher:pusher-java-client:2.0.2 version with some fixes for VMSMobileSDK purposes.

We support minSdk 23 - 6 Android. 2.4.4 version for Android 7 and above.

https://github.com/pusher/pusher-websocket-java

Initialization VMSPusherApi.kt

CODE
VMSMobileSDK.pusherApi.Builder(
    socketUrl: String,
    appKey: String,
    userToken: String,
    userId: Int,
    accessTokenId: String)

socketUrl - specific for provided base url, socket url to connect to WebSocket. See SocketApi to know how to get this info.

appKey - app key to connect to WebSocket. See SocketApi to know how to get this info.

userToken - token of current user.

userId - id of current user.

accessTokenId - access token id of current user

VMSPusherApi singleton object

onConnect() - use this function to connect to WebSocket

onDisconnect() - use this function to disconnect from WebSocket

VMSSocketEvents.kt

vmsLogoutSocket - In case user was logged out from system (ex. the session was deleted).

vmsCamerasSocket - In case list of cameras was updated for this user.

vmsCamerasSocket - In case list of groups cameras was updated for this user.

vmsPermissionsSocket - In case list of permissions was updated for this user.

vmsMarksSocket - In case created, updated, deleted marks/events of camera.

vmsArchiveLinkSocket - In case archive download url was generated successfully.

vmsIntercomKeySocket - In case intercom key confirmed or errors.

vmsIntercomSocket - In case intercom stored, renamed, updated, deleted.

vmsVisitorSocket - In case code of new visitor was added or deleted.

vmsVisitHistorySocket - In case call was added or deleted for calls history.

vmsCancelCallSocket - In case getting cancel socket for close ring intercom.

vmsErrorSocket - In case socket error happens and need to call getSocketUrl(), than if it successful rebuild pusher-socket and reconnect use this code:

CODE
VMSMobileSDK.pusherApi.Builder(
    getSocketUrlFull(),
    getAppKeyFull(),
    userStorage.token,
    userStorage.userData?.id ?: 0,
    userStorage.userData?.access_token_id ?: "",
).apply {
    VMSMobileSDK.pusherApi.isNeedReconnectSocket = false
    VMSMobileSDK.pusherApi.onConnect()
}

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.