Get token by room ID
Retrieve media room connection credentials using a room identifier.
When the application already possesses a roomID but needs to obtain or refresh its RTC authentication credentials, invoke signalingGetTokenByRoomID().
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
roomID | string | Yes | The target calling room identifier. |
Code example
import {
signalingGetTokenByRoomID,
} from '@/uni_modules/unix-openim-sdk'
const result = await signalingGetTokenByRoomID({ roomID })
if (result?.token != null) {
await mediaEngineJoin(roomID, result.token!, result.liveURL)
}Return value
The Promise resolves with an OpenIMSignalingGetTokenByRoomIDResult | null object containing nullable token and liveURL properties. The result object does not repeat roomID; retain the roomID supplied to the query when configuring your media engine connection.
If token is missing or null, do not attempt to join the media room. Re-query after network recovery or session re-authentication.
State changes after the call
This is a point-in-time credential query that does not modify call status or trigger events. For overall call session tracking and remote event streams, see Handle call events.
Was this page helpful?