3.1.0.alpha4
Pre-release
Pre-release
Real-Time Chat/Commenting Components
CollaborationMessageList
is a component that automatically displays all messages that are submitted to a particular topic. CollaborationMessageInput
is a component that enables submitting new messages to a topic. You can build real-time chat/commenting features to your app by adding these two components to the UI and connecting them to the same topic.
// User info will be used in the messages submitted by this user.
UserInfo user = new UserInfo(userId, userName, userImageUrl);
// Topic id can be considered as the identifier of a "chat room".
String topicId = "general";
// Component that displays messages posted to the topic:
CollaborationMessageList list = new CollaborationMessageList(user, topicId);
// Component that enables submitting new messages to the topic:
CollaborationMessageInput input = new CollaborationMessageInput(user, topicId);
// The rest is just building and styling the UI how you want.
VerticalLayout chatLayout = new VerticalLayout(list, input);
chatLayout.setHeight("500px");
chatLayout.setWidth("400px");
chatLayout.expand(list);
input.setWidthFull();
input.getStyle().set("flexShrink", "0");
add(chatLayout);
Other Changes
- The
CollaborationExampleComponent
prototype, which was included in earlier alpha versions, has been removed in favor of the new components. - Trying to use inactive topic connection throws now an exception. Trying to subscribe to data changes or update the data in Collaboration Engine while the topic connection is not active does not work. Now this is explicitly forbidden by throwing an exception. This affects only the low-level API usage (
CollaborationEngine.getInstance().openTopicConnection()
)
Compatibility
This version is targeted for Vaadin 20, and will be included in the following Vaadin 20 pre-release.