Socket
Socket
Sign inDemoInstall

agora-rtm-react

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

agora-rtm-react

A wrapper for Agora RTM Web SDK to use with react/reactjs


Version published
Weekly downloads
2.3K
decreased by-2.31%
Maintainers
1
Weekly downloads
 
Created
Source

Agora RTM SDK React Wrapper

A thin react.js wrapper for Agora RTM SDK.

This wrapper supports React >= v16.8

Install

npm install agora-rtm-react

Usage

import React from 'react'
import { createChannel, createClient, RtmMessage } from 'agora-rtm-react'

const useClient = createClient('<Agora App ID>');
const useChannel = createChannel('channelName')

const App = () => {
  const client = useClient();
  const testChannel = useChannel(client)

  const login = async () => {
    await client.login({ uid: 'userId' })
    await testChannel.join()
  }
  
  const sendMsg = async (text: string) => {
    const message = client.createMessage({ text, messageType: 'TEXT' })
    await testChannel.sendMessage(message)
  }
...
}

Example

A chat example using the wrapper can be found in ./example

Docs

You can view the wrapper docs, Web SDK docs and the SDK API Reference

FAQs

Package last updated on 06 Dec 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc