Options
All
  • Public
  • Public/Protected
  • All
Menu

Class RtmEngine

RtmEngine is the entry point of the react native agora rtm sdk. You can call the createClient method of RtmEngine to create an RtmEngine instance.

noinheritdoc

Hierarchy

  • RtmEngine

Index

Constructors

constructor

Properties

Private events

events: NativeEventEmitter

Static Private AG_RTMCHANNEL

AG_RTMCHANNEL: "ag_rtm_" = "ag_rtm_"

Static Private version

version: string = "1.0.0-alpha.1"

Methods

acceptRemoteInvitation

  • acceptRemoteInvitation(remoteInvitationProps: RemoteInvitationProps): Promise<any>
  • supports platform: ios, android This method enables accept remote invitation with RemoteInvitationProps. NOTICE: content bytelength has MAX_SIZE 32kb limit.

    Parameters

    • remoteInvitationProps: RemoteInvitationProps

    Returns Promise<any>

    Promise

cancelLocalInvitation

  • cancelLocalInvitation(invitationProps: LocalInvitationProps): Promise<any>
  • supports platform: ios, android This method enables cancel local invitation with invitationProps. NOTICE: content bytelength has MAX_SIZE 32kb limit.

    Parameters

    • invitationProps: LocalInvitationProps

      LocalInvitationProps

      uid | string | required | channelId | string | required |

      content | string | optional | 32kb limit |

    Returns Promise<any>

    Promies

createClient

  • createClient(appId: string): void
  • supports platform: ios, android This method creates AgoraRTM instance and begin event observing, collect all both remote and local invitaitons and channels resources. method: createClient

    Parameters

    • appId: string

      String

    Returns void

    void

destroyClient

  • destroyClient(): void
  • supports platform: ios, android This method destroy AgoraRTM instance, stop event observing, release all both remote and local invitaitons and channels resources.

    Returns void

    void

getChannelMembersBychannelId

  • getChannelMembersBychannelId(channelId: string): Promise<any>
  • supports platform: ios, android This method enables you get members by channel id.

    Parameters

    • channelId: string

      string.

    Returns Promise<any>

    Promise {@link Members}}


    MemberInfo

    uid | string | user id|

    channelId | string | channel id|

getSdkVersion

  • getSdkVersion(callback: Callback): void
  • get the version of rtm sdk

    Parameters

    • callback: Callback

      (version) => {} required

    Returns void

getUserAttributesByUid

  • getUserAttributesByUid(uid: string): Promise<UserProfile>
  • supports platform: ios, android This method enables you get user attributes by uid.

    Parameters

    • uid: string

      string. user id

    Returns Promise<UserProfile>

    Promise {@link UserProfile}

joinChannel

  • joinChannel(channelId: string): Promise<any>
  • supports platform: ios, android This method do join channel with channelId

    Parameters

    • channelId: string

      string

    Returns Promise<any>

    Promise

leaveChannel

  • leaveChannel(channelId: string): Promise<any>
  • supports platform: ios, android This method do leave channel with channelId

    Parameters

    • channelId: string

      string

    Returns Promise<any>

    Promise

login

  • login(params: UserInfo): Promise<any>
  • supports platform: ios, android This method do login with UserInfo

    Parameters

    • params: UserInfo

      token | string | optional |

      uid | string | required |

    Returns Promise<any>

    Promise

logout

  • logout(): Promise<any>
  • supports platform: ios, android This method do logout.

    Returns Promise<any>

    Promise

on

  • on<EventName>(eventName: EventName, callback: RTMEventCallback): void
  • supports platform: ios, android

    events

    RtmEngineEvents

    Type parameters

    • EventName: keyof RtmEngineEvents

    Parameters

    • eventName: EventName
    • callback: RTMEventCallback

      (evt) => {} required

    Returns void

queryPeersOnlineStatus

  • queryPeersOnlineStatus(ids: string[]): Promise<any>
  • supports platform: ios, android This method enables query peer online user by id array.

    Parameters

    • ids: string[]

      string array

    Returns Promise<any>

    MemberStatus

    uid | string | user id|

    online | boolean | online state|

refuseRemoteInvitation

  • refuseRemoteInvitation(remoteInvitationProps: RemoteInvitationProps): Promise<any>
  • supports platform: ios, android This method enables refuse remote invitation with RemoteInvitationProps. NOTICE: content bytelength has MAX_SIZE 32kb limit.

    Parameters

    • remoteInvitationProps: RemoteInvitationProps

    Returns Promise<any>

    Promise

removeAllLocalUserAttributes

  • removeAllLocalUserAttributes(): Promise<any>
  • supports platform: ios, android This method enables you to remove all of local user attributes;

    Returns Promise<any>

    Promise

removeLocalUserAttributesByKeys

  • removeLocalUserAttributesByKeys(keys: string[]): Promise<any>
  • supports platform: ios, android This method enables you to remove exists attribute for local user.

    Parameters

    • keys: string[]

      string []

    Returns Promise<any>

    Promise

renewToken

  • renewToken(token: String): Promise<any>
  • supports platform: ios, android This method do renewToken when got tokenExpired event.

    Parameters

    • token: String

      String

    Returns Promise<any>

    Promise

replaceLocalUserAttributes

  • replaceLocalUserAttributes(attributes: UserAttribute[]): Promise<any>
  • supports platform: ios, android This method enables you to replace attribute already exists or add attribute wasn't set for local user attributes;

    Parameters

    • attributes: UserAttribute[]

    Returns Promise<any>

    Promise

sendLocalInvitation

  • sendLocalInvitation(invitationProps: LocalInvitationProps): Promise<any>
  • supports platform: ios, android This method enables send local invitation with invitationProps. NOTICE: content bytelength has MAX_SIZE 32kb limit.

    Parameters

    • invitationProps: LocalInvitationProps

      LocalInvitationProps

      uid | string | required | channelId | string | required |

      content | string | optional | 32kb limit |

    Returns Promise<any>

    Promise

sendMessageByChannelId

  • sendMessageByChannelId(channelId: string, text: string): Promise<any>
  • supports platform: ios, android This method enables send message by channel id. NOTICE: text bytelength has MAX_SIZE 32kb limit.

    Parameters

    • channelId: string

      string.

    • text: string

      string (bytesize shouldn't >= 32kb)

    Returns Promise<any>

    Promise

sendMessageToPeer

  • sendMessageToPeer(params: AgoraPeerMessage): Promise<any>
  • supports platform: ios, android This method do send p2p message with {@link AgoraPeerMessage}

    Parameters

    • params: AgoraPeerMessage

      AgoraPeerMessage

      peerId | string | required | offline | boolean | requried |

      text | string | required |

    Returns Promise<any>

    Promise

setLocalUserAttributes

  • setLocalUserAttributes(attributes: UserAttribute[]): Promise<any>
  • supports platform: ios, android This method enables set local user attributes with attributes {@link UserAttribute}

    Parameters

    • attributes: UserAttribute[]

    Returns Promise<any>

    Promise

    UserAttribute

    key | string | required |

    value | string | required |

setSdkLog

  • setSdkLog(path: string, level: LogLevel, size: number): Promise<any>
  • set sdk log file

    Parameters

    • path: string

      string: specified the generated log path

    • level: LogLevel

      : sdk log level (0: "OFF", 0x0f: "INFO", 0x0e: "WARN", 0x0c: "ERROR", 0x08: "CRITICAL")

    • size: number

      number: file size in kbytes Note File size settings of less than 512 KB or greater than 10 MB will not take effect.

    Returns Promise<any>

    Promise This method will return {path: boolean, level: boolean, size: boolean}

Generated using TypeDoc