Skip to content

Commit

Permalink
Merge pull request #3332 from haoxiuwen/agora-chat
Browse files Browse the repository at this point in the history
Modify Agora Chat EN Docs
  • Loading branch information
haoxiuwen authored Sep 20, 2023
2 parents d5d5999 + 65d2981 commit 68329c6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function sendPrivateText() {
chatType: "singleChat",
};
// Create a text message.
let msg = WebIM.message.create(option);
let msg = AC.message.create(option);
// Call send to send the message
conn.send(msg).then((res)=>{
console.log("Send message success",res);
Expand All @@ -68,7 +68,7 @@ function sendTextMessage() {
to: "chat room ID",
chatType: "chatRoom",
};
let msg = WebIM.message.create(opt);
let msg = AC.message.create(opt);
conn.send(msg).then(()=>{
console.log("Send message success");
}).catch((e)=>{
Expand All @@ -85,7 +85,7 @@ When a message arrives, the recipient receives an `onXXXMessage` callback. Each

```javascript
// Use `addEventHandler` to listen for callback events.
WebIM.conn.addEventHandler("eventName",{
connection.addEventHandler("eventName",{
// Occurs when the app is connected.
onOpened: function (message) {},
// Occurs when the connection is lost.
Expand Down Expand Up @@ -163,7 +163,7 @@ connection.recallMessage(option).then((res) => {
You can also use `onRecallMessage` to listen for the message recall state:
```javascript
WebIM.conn.addEventHandler('MESSAGES',{
connection.addEventHandler('MESSAGES',{
onRecallMessage: => (msg) {
// You can insert a message here, for example, XXX has recalled a message.
console.log('Recalling the message succeeds',msg)
Expand Down Expand Up @@ -196,11 +196,11 @@ Refer to the following code example to create and send a voice message:
```javascript
var sendPrivateAudio = function () {
// Create a voice message.
var msg = new WebIM.message('audio');
var msg = new AC.message('audio');
// Select the local audio file.
var input = document.getElementById('audio');
// Turn the audio file to a binary file.
var file = WebIM.utils.getFileUrl(input);
var file = AC.utils.getFileUrl(input);
var allowType = {
'mp3': true,
'amr': true,
Expand Down Expand Up @@ -232,7 +232,7 @@ Refer to the following code example to create and send a voice message:
ext: {file_length: file.data.size}
};
// Create a voice message.
var msg = WebIM.message.create(option);
var msg = AC.message.create(option);
// Call send to send the voice message.
conn.send(msg).then((res)=>{
// Occurs when the audio file is successfully sent.
Expand All @@ -254,7 +254,7 @@ Refer to the following code example to create and send an image message:
// Select the local image file.
var input = document.getElementById("image");
// Turn the image to a binary file.
var file = WebIM.utils.getFileUrl(input);
var file = AC.utils.getFileUrl(input);
var allowType = {
jpg: true,
gif: true,
Expand Down Expand Up @@ -288,7 +288,7 @@ Refer to the following code example to create and send an image message:
},
};
// Create a voice message.
var msg = WebIM.message.create(option);
var msg = AC.message.create(option);
// Call send to send the voice message.
conn.send(msg).then((res)=>{
// Occurs when the audio file is successfully sent.
Expand Down Expand Up @@ -318,7 +318,7 @@ To send a URL image message, make sure you set `useOwnUploadFun` as `true`.
to: "username",
};
// Create an image message.
var msg = WebIM.message.create(option);
var msg = AC.message.create(option);
// Call send to send to image file.
conn.send(msg);
};
Expand All @@ -336,7 +336,7 @@ Refer to the following code example to create and send a video message:
// Select the local video file.
var input = document.getElementById("video");
// Turn the video to a binary file.
var file = WebIM.utils.getFileUrl(input);
var file = AC.utils.getFileUrl(input);
var allowType = {
mp4: true,
wmv: true,
Expand Down Expand Up @@ -368,7 +368,7 @@ Refer to the following code example to create and send a video message:
ext: {file_length: file.data.size},
};
// Create a video message.
var msg = WebIM.message.create(option);
var msg = AC.message.create(option);
// Call send to send the video message.
conn.send(msg).then((res)=>{
// Occurs when the message is sent.
Expand All @@ -390,7 +390,7 @@ Refer to the following code example to create, send, and receive a file message:
// Select the local file.
var input = document.getElementById("file");
// Turn the file message to a binary file.
var file = WebIM.utils.getFileUrl(input);
var file = AC.utils.getFileUrl(input);
var allowType = {
jpg: true,
gif: true,
Expand Down Expand Up @@ -425,7 +425,7 @@ Refer to the following code example to create, send, and receive a file message:
ext: {file_length: file.data.size},
};
// Create a file message.
var msg = WebIM.message.create(option);
var msg = AC.message.create(option);
// Call send to send the file message.
conn.send(msg).then((res) => {
// Occurs when the file message is sent.
Expand Down Expand Up @@ -457,7 +457,7 @@ const sendLocMsg = () => {
lat: Math.round(coords.latitude),
lng: Math.round(coords.longitude),
};
let msg = WebIM.message.create(option);
let msg = AC.message.create(option);
conn.send(msg).then((res)=>{
console.log("Send message success", res);
}).catch((e)=>{
Expand Down Expand Up @@ -488,7 +488,7 @@ var options = {
ext :{'extmsg':'extends messages'}
}
// Create a CMD message.
var msg = WebIM.message.create(options);
var msg = AC.message.create(options);
// Call send to send the CMD message.
conn.send(msg).then((res)=>{
// Occurs when the message is sent.
Expand Down Expand Up @@ -526,7 +526,7 @@ var sendCustomMsg = function () {
ext: {},
}
// Create a custom message.
var msg = WebIM.message.create(options);
var msg = AC.message.create(options);
// Call send to send the custom message.
conn.send(msg).then((res)=>{
// Occurs when the message is sent.
Expand Down Expand Up @@ -557,7 +557,7 @@ function sendPrivateText() {
},
}
}
let msg = WebIM.message.create(options);
let msg = AC.message.create(options);
// Call send to send the extended message.
conn.send(msg).then((res)=>{
console.log("send private text Success");
Expand All @@ -572,4 +572,6 @@ function sendPrivateText() {
After implementing sending and receiving messages, you can refer to the following documents to add more messaging functionalities to your app:
- [Retrieve conversations and messages from the server](./agora_chat_retrieve_message_web?platform=Web)
- [Message receipts](./agora_chat_message_receipt_web?platform=Web)
- [Message receipts](./agora_chat_message_receipt_web?platform=Web)
7 changes: 4 additions & 3 deletions en-US/markdown/agora-chat/Develop/agora_chat_callkit_web.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Take the following steps to download and import AgoraChatCallKit into your proje
1. In your terminal, run the following command to install the call kit:

```bash
npm install AgoraChatCallKit
npm install chat-callkit
```

2. Add the following line to import the callkit:
Expand Down Expand Up @@ -120,7 +120,7 @@ The following screenshot gives an example of the user interface after sending a

### Receive the invitation

Once a call invitaion is sent, if the callee is online and available for a call, the callee receives the invitation in the `onInvite` callback. You can pop out a user interface that allows the callee to accept or decline the invitation in this callback.
Once a call invitation is sent, if the callee is online and available for a call, the callee receives the invitation in the `onInvite` callback. You can pop out a user interface that allows the callee to accept or decline the invitation in this callback.

```javascript
/**
Expand Down Expand Up @@ -224,7 +224,8 @@ Attributes
| Attribute | Description |
| --- | --- |
| contactAvatar | The avatar displayed during one-to-one calls. |
| groupAvatar | The avatar displayed during group calls.
| groupAvatar | The avatar displayed during group calls.|
| ringingSource | The ringtone file. |
### Sample project
Expand Down

0 comments on commit 68329c6

Please sign in to comment.