Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface NIMInterface

Basic interface definition for NIM instance

Hierarchy

  • NIMInterface

Implemented by

Index

Methods

  • connect(): void
  • After logging out of IM using the disconnect method, you can call connect to log in again. After calling getInstance, a persistent connection will be established automatically without calling connect

    Associated function

    Example

    nim.disconnect({
    done: function() {
    nim.connect()
    }
    })

    Returns void

  • destroy(options: { done?: any }): void
  • Disconnect from the server and destroy the IM instance If the instance is destroyed, you cannot call connect to reconnect to the chat room.

    Note that in NIM SDK v9.9.0 and earlier versions, the ondisconnect callback function will be triggered directly after calling destroy, but the persistent connection is not actually closed. Only when the done callback is triggered, can the persistent connection be truly closed. To avoid device exclusion during reconnection, you must set reconnection and other operations in the done callback for the destroy method.

    Associated function

    Parameters

    Returns void

  • disconnect(options: { done?: any }): void
  • Disconnect from the server, but do not destroy the IM instance After logging in by calling connect, the data will be incrementally synchronized based on the instance status

    Note that in NIM SDK v9.9.0 and earlier versions, the ondisconnect callback function will be triggered directly after calling destroy, but the persistent connection is not actually closed. Only when the done callback is triggered, can the persistent connection be truly closed. To avoid device exclusion during reconnection, you must set reconnection and other operations in the done callback for the destroy method.

    Associated function

    Notes

    Parameters

    Returns void

  • kick(options: { deviceIds: []; done?: any }): void
  • logout(): void
  • deprecated

    Log out

    Note: For SDK earlier than v9.6.0, it is recommended to logout first and disconnect/destroy to fully exit the chat room.. SDK v9.6.0 and later do not need to call this API, it will be called automatically before disconnect/destroy.

    Returns void

  • Update the initialization parameters of the original NIM instance. The configurable parameters are the same as those of the NIM.getInstance method.

    Use cases

    Any scenario that needs to update parameters for initialization. For example:

    • When a dynamic token is used to log in, the dynamic token, update a dynamic token by this API.
    • When using a static token to log in, refresh and update the static token using this API.

    For details about IM login, see initialization and login IM.

    Parameters

    Returns void