agora-chat
TypeScript icon, indicating that this package has built-in type declarations

1.2.1 • Public • Published

Agora chat sdk Introduction

This is a preview version, 1.2.1 - preview.

This version is a preview and should be used for testing purposes only. For production use, please revert to the official stable release. If you require the use of this preview version, please contact Agora.io for assistance.

Agora chat sdk provides complete instant messaging function development capabilities, shields/encapsulate and block its internal complex details, and provides a relatively simple and concise API interface to facilitate third-party applications to quickly integrate instant messaging functions for PC/mobile Web applications


Chat SDK can be integrated in the following way:

  1. Install
npm install agora-chat --save
  1. Import agora-chat
import AC from 'agora-chat';
  1. Initialize the SDK
const conn = new AC.connection({
	appKey: '<your app key>',
});
  1. Login chat server
const options = {
	user: 'userID',
	agoraToken: 'agoraToken',
};
conn.open(options);
  1. Send a message
let option = {
	chatType: 'singleChat',
	type: 'txt',
	to: 'userID',
	msg: 'message content',
};
let msg = AC.message.create(option);
conn.send(msg)
	.then(() => {
		console.log('send private text Success');
	})
	.catch((e) => {
		console.log('Send private text error');
	});

Reference

Related resources

  • Check our FAQ to see if your issue has been recorded.
  • Dive into Agora SDK Samples to see more tutorials
  • Take a look at Agora Use Case for more complicated real use case
  • Repositories managed by developer communities can be found at Agora Community
  • If you encounter problems during integration, feel free to ask questions in Stack Overflow

Readme

Keywords

none

Package Sidebar

Install

npm i agora-chat

Weekly Downloads

870

Version

1.2.1

License

ISC

Unpacked Size

1.49 MB

Total Files

51

Last publish

Collaborators

  • agora.io
  • agorabuilder