messages

Message

The message function provided by Game Chat includes various services supporting efficient communication between users. This platform is suitable for group chat as well as personal chat, and it enables a simple, fast process of sending and receiving messages. The following describes Game Chat's main message functions and their features.

1. Instant messaging

  • Real-time communication: you can send and receive messages in real time, which minimizes communication delay.

  • Supporting multiple devices: you can send and receive messages on various devices such as smartphones, tablets, PCs, and so on.

2. Group chat

  • Multiple participants: you can create a group chat that many people can participate in to share information and enhance communication within the team.

  • Manage channel: the admin can add or delete members through the group chat, and adjust the group settings.

3. File sharing

  • Supporting various file formats: you can easily share files in diverse formats such as texts, images, videos, and documents through the chat.

  • Safe file storage: Game Chat saves and manages files in your Object Storage, preventing any information leaks.

4. Message search

  • Keywords search: you can use a specific keyword to search for the past conversation content in the chat.

  • Advanced filter options: you can quickly find the messages you want to search for by applying various filters, such as date, participant, and file format.

5. Notification adjustments

  • Push notifications: when a new message or an important update occurs, a notification is sent to the user to prevent information omission.

  • Notification setting: you can adjust the type and frequency of notification to receive the information in a desired way.

6. Security and personal information protection

  • Data encryption: all messages are encrypted during transmission and storage to prevent data leaks from the outside.

  • Protecting personal information: personal information and dialogs of the user are strictly protected, and are not disclosed to any third party without the consent of the user.

The message function of Game Chat promotes easy and efficient communication of the user, and has an important role in business and daily life. These functions promote easy user communication, and enhance teamwork.

Forward message

If you have created and joined a channel, you can send a new message by calling the following:

const message = 'Hello !!!';
await nc.sendMessage(
        channelId: CHANNEL_ID, 
        type:"text", 
        content: message
);


// When replying to a message
await nc.sendMessage(
        channelId: CHANNEL_ID, 
        type:"text", 
        content: message, 
        parentMessageId: [MESSAGE_ID]
        );

// When an automatic translation is required for a message
await nc.sendMessage(
        channelId: CHANNEL_ID, 
        type:"text", 
        content: message, 
        translate: true
        );

// In a new message, the contents of the parent message are reinforced and sent with parent_message as shown below.
{
    "id": "message_id",
    "text": "Message",
    "parent_message_id": "first_message_id",
    "parent_message": { 
        "id": "message_id", 
        "text": "message_name",
        "sender" : {
            "id" : "Sender",
             "name" : "Sender Nickname",
             "profile" : "profile url"
        }
    }
}

Note

If you send/receive messages in JSON format, you can use various user-defined values.

Hashtable messageArray = new Hashtable
{
    { "channel_id", "channelId" },
    { "state", 1 },
    { "desc" , "Desc" }
};
// Convert the message to plain text.
const jsonString = JsonConvert.SerializeObject(messageArray);
// Convert the received message to an Array.
Hashtable hashtable = JsonConvert.DeserializeObject<Hashtable>(jsonString);
  • Using Express Message: this function is only for sending messages at high speed. By removing all parts that may cause a delay, messages can be transferred 10 times faster than with the previous method. The difference from normal sendMessage is as follows:

Available to use for any service that requires real-time PvP production or high-speed broadcasting within the game.

Upload files

  • You can transfer files to a specific channel.

  • You can only upload allowed file types by navigating to Dashboard > Settings > Security.

await nc.sendFile([CHANNEL_ID],file);

Note

  • Object Storage must be enabled.

  • You can use it after integrating with the Object Storage product.

  • When uploading, set the upload type and upload size, etc. in Set Project > Security Settings in the dashboard.

  • Supported file types: all general types such as images, videos, documents, and zips are supported. For an extension that needs to be supported additionally, send inquiries through Contact us, and we will add it after reviewing its security.

  • When using the file link, the Endpoint address is https://apps.ncloudchat.naverncp.com. For example, https://apps.ncloudchat.naverncp.com/archive/[archiveId]

Message information

  • Message Data Class

Individual message information

You can get information about individual messages.

NBaseSDK.Message message = await nc.getMessage([CHANNEL_ID], [MESSAGE_ID]);

All messages information

You can get information on all messages.

Hashtable filter = new Hashtable
{
    { "channel_id", [CHANNEL_ID] }
};
Hashtable sort = new Hashtable
{
    { "sort_id", -1 }
};
Hashtable option = new Hashtable
{
    { "offset", 0 },
    { "per_page", 10 }
};
var messages = await nc.getMessages(filter, sort, option);
if (messages != null)
    {
            foreach (var message in messages.edges)
        {
            string id = message.Node.message_id.ToString();
            Console.WriteLine("[CloudChatSample] id={0}", id);
        }
    }
  • Parameters

  • Options

Unread messages

Return the number of unread messages. Send the information of the last read message through markRead first.

nc.markRead([CHANNEL_ID], new NBaseSDK.Mark 
{
    user_id = USER_ID, 
    message_id = MESSAGE_ID,
    sort_id = SORT_ID
});
// Return the number of unread messages after being marked.
var unread = nc.unreadCount([CHANNEL_ID]);

Delete message

You can delete messages you sent within the channel.

await nc.deleteMessage([CHANNEL_ID], [MESSAGE_ID]);
  • Parameters

Last updated