Your search did not match any results.

Chat - Overview

JavaScript Chat is an interactive UI component designed to send/receive messages in real time.

To get started with the DevExtreme JavaScript Chat component, refer to the following step-by-step tutorial: Getting Started with JavaScript Chat.

The demo implements basic JavaScript Chat functionality: specifies initial messages, updates the conversation with new incoming/outgoing messages, manages users, and links two chats in real-time.

The source code for the Mvc version of this demo will be available soon.

Messages

To specify an initial message, you can populate the items array (shown in this demo) or use a dataSource.

Use the following API to render new messages:

Users

To specify the chat owner, set the user property. Owner messages align to the right (or left in RTL mode) and do not display a name or avatar.

Each message includes information about the sender (author): name, avatar, and alternative avatar text. If no avatar is set, the user's initials are displayed instead.

Events

If a user enters a message, the JavaScript Chat component raises the messageEntered event. Use the event handler to process the message. For example, you can display the message in the message feed and send the message to the server for storage.

When users start or complete text entry, our JavaScript Chat component raises typingStart and typingEnd events. Use these events to manage the typingUsers array. The DevExtreme JavaScript Chat uses this array to display a list of active users.