🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

react-native-azure-communication-services

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-azure-communication-services

test

0.1.2
latest
Source
npm
Version published
Maintainers
1
Created
Source

react-native-azure-communication-services

Used to link azure communication services modules with react native

Installation

npm install react-native-azure-communication-services --save

or

yarn add react-native-azure-communication-services

Refer to:

https://learn.microsoft.com/en-us/azure/communication-services/quickstarts/chat/get-started?tabs=windows&pivots=programming-language-swift

To add configurations for Swift and Android.

Usage

import { initChatClient } from 'react-native-azure-communication-services';

initChatClient(response.data.acsEndpoint, response.data.userToken)
import { createChatThread } from 'react-native-azure-communication-services';

createChatThread(topic, [
  {
    id: userId,
    name: senderDisplayName,
  },
])
import { addParticipant } from 'react-native-azure-communication-services';

addParticipant(threadId, userId, userName);
import {
  eventKeys,
  sendChatMessage,
  stopRealTimeNotifications,
  startRealTimeNotifications
} from 'react-native-azure-communication-services';

  useEffect(() => {
    startRealTimeNotifications();

    const eventEmitter = new NativeEventEmitter(
      NativeModules.AzureCommunicationServices
    );
    const event = eventEmitter.addListener(
      eventKeys.MESSAGE_RECEIVED,
      (message) => {
        console.log('MESSAGE RECEIVED!', message);
        message &&
          setMessageHistory((state: string[]) => [...state, message.content]);
      }
    );
    return () => {
      stopRealTimeNotifications();
    };
  }, []);

...


  sendChatMessage(threadId, content, senderDisplayName, 'text', {
    hasAttachment: 'true',
    attachmentUrl: 'https://contoso.com/files/attachment.docx',
  });

License

MIT

Keywords

react-native

FAQs

Package last updated on 18 Apr 2023

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