Directory

Chat - Vaadin Add-on Directory

Web Component providing an easy way to display chat on web pages Chat - Vaadin Add-on Directory
## Note Vaadin 14.7 has new MessageList component which integrates to Collaboration Engine. See more https://vaadin.com/docs/v14/ce/components/collaboration-message-list ## Usage Create instance of `Chat`. You can set messages using `setMessages(List)` method. Messages in list should be sorted from older to newer, as last messages in list will be shown in bottom of chat and would represent newer messages. Message object contains message text, sender name, sender avatar(url to avatar image) and indicator whether it's incoming or outgoing message(currentUser parameter). Avatar url should not be null but can be empty string. If it's set to empty string, image from first letters of first and last names will be create created. If message have parameter `currentUser` set to `true` it means that message is outgoing and will appear on right sight of chat, else it will be incoming message and appear on left side of chat. After adding list of messages you, more likely, would like to scroll chat to the bottom, where newer messages are. You can do that by calling method `scrollToBottom()`. Chat have text input and Send button. Clicking Send button or clicking `Ctrl+Enter` will dispatch `vcf-chat-new-message` event with users message as parameter. Use `addChatNewMessageListener(ComponentEventListener)` to handle event. You can add message to bottom of chat using method `addNewMessage(Message)`. After message is added you can clear input by calling `clearInput` on chat instance. When user scrolls messages towards top and `scrollTop` value is smaller then `lazyLoadTriggerOffset` parameter of Chat instance, event `vcf-chat-trigger-lazy-load` will be raised(and will be raising on every scroll event with debounce time set in `debouncePeriod` parameter of chat instance). Use `addLazyLoadTriggerEvent(ComponentEventListener)` to handle event. You can add older messages to top of chat using method `addMessagesToTop(List)`. When `vcf-chat-trigger-lazy-load` event is triggered, loading indication is shown in chat and can be disabled by calling `setLoading(false)` method on chat instance. Loading also can be enabled manually by calling same method with `true` value. ### Client-side implementation This is the server-side (Java) API for Vaadin Platform for the vcf-chat component. Looking for the client-side version? It can be found here: https://vaadin.com/directory/component/vaadin-component-factoryvcf-chat ## License & Author This Add-on is distributed under Apache 2.0 Component Factory Chat is written by Vaadin Ltd. ### Sponsored development Major pieces of development of this add-on has been sponsored by multiple customers of Vaadin. Read more about Expert on Demand at: [Support](https://vaadin.com/support) and [Pricing](https://vaadin.com/pricing)
Online Demo
View on GitHub

Chat version 1.2.0
Updated client side dependency to vcf-chat v1.2.0

Chat version 2.0.0
### Version 2.0.0 - Uses P3 version of the component in npm mode of Vaadin 14

Chat version 2.0.1
Update the license to Apache 2.0