Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: Notifications in Liferay with no need to refresh or send any request.
I was trying to send a notification to the user after he has succesfully done an action, using:
NotificationEvent notificationEvent = NotificationEventFactoryUtil.createNotificationEvent(System.currentTimeMillis(), "com_liferay_document_library_web_portlet_DLPortlet", notificationEventJSONObject);
notificationEvent.setDeliveryType(10002);
List<User> allUsers = UserLocalServiceUtil.getUsers(QueryUtil.ALL_POS,QueryUtil.ALL_POS);
try {
for (User u : allUsers) {
UserNotificationEventLocalServiceUtil.addUserNotificationEvent(u.getUserId(), notificationEvent);
}
} catch (PortalException e) {
logger.error("Error occured during sending the portal notification to user", e);
}
This works as expected, however this notifications pop up in the
receiver user after doing a request (eg, refrteshing the page). Is
there a better way to inform users of something in Liferay without the
need of them to refresh the page like a sort of push from server to
the websocket?
PD: Moreoever I was wondering where can I consult the different
available delivery types for the notification events.
Thank you very much in advance!
Hi there,
This is not an answer, just a follow-up. I am trying to do a similar thing. Did you figure out how to accoplish this task? Does anyone know how Liferay 7.2 or &.4 supports web push notifications?
Thank you for any suggestions.
Alla
See this. We followed that combined with some javascript and AUI for the notification to appear when onMessage triggers.
Powered by Liferay™