Socket
Socket
Sign inDemoInstall

react-native-azure-communication-services

Package Overview
Dependencies
783
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-native-azure-communication-services

test


Version published
Weekly downloads
1
Maintainers
1
Created
Weekly downloads
 

Readme

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

FAQs

Last updated on 18 Apr 2023

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc