- A browser supported by the Agora RTM Web SDK (Chrome 49 or later, Firefox 52 or later, Safari 9 or later, and Internet Explorer 11 or later)
- A valid Agora account.
- Open ports as specified in Firewall Requirements if your network has a firewall.
Implement real-time messaging
1. Create an Agora project
To create an Agora project, do the following:
- Enter the Project Management page.
- Click Create.
- Follow the on-screen instructions to enter a project name and use case, and check Secured mode: APP ID + Token (Recommended) as the authentication mechanism.
- Click Submit. You can now see the project on the Project Management page.
2. Get an App ID
Agora automatically assigns each project an App ID as a unique identifier.
To copy this App ID, find your project on the Project Management page in Agora Console, and click the icon in the App ID column.
3. Get an App Certificate
To get an App Certificate, do the following:
- On the Project Management page, click Config for the project you want to use.
- Click the copy icon under Primary Certificate.
4. Generate a token
To ensure communication security, Agora recommends using tokens to authenticate users logging in to an RTM system.
For testing purposes, Agora Console supports generating RTM tokens. To generate an RTM token:
- Visit https://webdemo.agora.io/token-builder.
- Fill in the App ID, App certificate, and user ID to log in to the RTM system. You need to specify the user ID yourself (for example, "test"). The generated RTM token is showed on the screen. When calling the
login method later, ensure that the user ID is the same with the one that you use to generate the RTM token.
RTM tokens generated in this way are for demonstration and testing purposes only, and remain valid for 24 hours. In a production environment, you need to deploy your own server for generating tokens. For details, see Authenticate Your Users with RTM Tokens
5. Install dependencies and run the sample project
Refer to the following steps to integrate the RTM SDK into the sample project:
Download the RTM repository on Github, and locate the
Go to the directory of the
Agora-RTM-Tutorial-Web folder, and run the following command to install dependencies:
$ npm install
Run the following command to run the sample project:
$ npm run dev
After the project runs successfully, enter your App ID and token to try the project.
You must log in with the user ID you entered to generate the token.
When the sample project runs successfully, you can see the following interface. You can enter the same App ID, Account Name (user ID) and temporary token to join the same channel and communicate with the remote user.