Liferay Portal Enterprise Intranets — Save 80%
A practical guide to building a complete corporate intranet with Liferay
As an administrator of an intranet website, you are required to provide an environment for employees to enjoy chatting, instant messaging and others. This article by Jonas X. Yuan will introduce to us, how to enjoy instant messaging.
In this article we will learn how to:
- Add a participant for chatting.
- Manage (view and delete) participants in the chat portlet.
- Start chatting.
- Set up chat portlet.
Working with Chat Portlet
For the purpose of this article, we will use an intranet website called book.com which is created for a fictions company named "Palm Tree Publications".
In order to let employees enjoy chatting and instant messaging with others, we should use the Liferay Chat portlet. Let's experience how to enjoy chatting and instant messaging first.
As an administrator of "Palm Tree Publications", you need to create a Page called "Instant Messaging" under the Page, "Community", at the Book Lovers Community and also add the Chat portlet in the Page, "Instant Messaging".
Adding a Participant
First of all, log in as "Palm Tree" and do the following:
- Add a Page called "Instant Messaging" under the Page, "Community" at the Book Lovers Community Public Pages, if the Page is not already present.
- Add the Chat portlet in the Page, "Instant Messaging" of the Book Lovers Community where you want to set up chatting and an instant messaging environment, if Chat portlet is not already present.
After adding the Chat portlet, you can view it as shown in the following figure.
Then, we need to add a participant in the Chat portlet. As an editor at the Editorial department, "Lotti Stein" wants to ping the manager, "David Berger", online and further share some comments about Liferay books. Let's do it as follows:
- Login as "Lotti Stein" first.
- Go to the Page, "Instant Messaging", " under the Page, "Community", at the Book Lovers Community Public Pages.
- Click on the Add icon.
- Input a participant's email address, such as "email@example.com".
- Press the Enter key.
You will see the participant's full name appear, such as "David Berger". After adding more participants, such as "John Stuckia" and "Rolf Hess", you can view all participants as shown in the following figure.
All the Users you've invited will appear as a list of participants. If the User "David Berger" is online ,then the icon to the left of the User name becomes light blue. Otherwise, it remains light gray; for example, User "John Stuckia". As shown in the following figure, only two Users ("David Berger" and "Lotti Stein") are online in the server. For details about OpenFire, refer to the forthcoming section.
The participants are removable. For example, "Lotti Stein" wants to remove a participant "Rolf Hess", from the list of participants. Let's do it as follows:
- Locate the participant, such as "Rolf Hess".
- Click on the icon to the left of the User name, such as "Rolf Hess". You will see that the participant "Rolf Hess" is highlighted.
- Click the Remove icon. This participant will be removed from the list of participants.
In short, to remove a User from the list of participants, simply locate the User you want to remove by clicking on the icon to the left of the User name. Then, click the Remove icon. The selected User name will be removed from the list of participants.
Irrespective of whether the participants are online or not, you can begin to Chat with them. For example, as an editor of editorial department, "Lotti Stein" wants to start chatting with the manager, "David Berger". Let's do it as follows:
- Locate the participant, "David Berger".
- Click the User name, "David Berger".
- A Chat box will appear.
- Input the message, "David, how are you?"
- Press the Enter key. Your messages will appear starting with the keyword, Me, in the message box (as shown in the following figure).
As a manager of the editorial department, "David Berger" will have to do the following, to receive the messages from "Lotti Stein":
- Login as "David Berger" in new browser.
- Go to the Page, "Instant Messaging" under the Page, "Community" at the Book Lovers Community Public Pages.
- Locate the participant, "Lotti Stein".
- Click the User name, "Lotti Stein".
- A chat box will appear with the messages from "Lotti Stein".
- Input the message, "I am fine, and you?"
- Press the Enter key. Your messages will appear starting with the keyword "Me:" in the message box and the messages sent by the other User, "Lotti Stein" here, will appear starting with the User's name as shown in the following figure:
Generally, to start chat, locate the User you want to chat with, by the User name first. Click on the User name link. A Chat box will appear. You can chat with many Users at the same time. To do this, just click on the Users' name link. Each Chat box is only for one unique User.
The Chat box contains the User's name on the upper left. You can close the current Chat box by clicking on the mark X to the upper right.
Note that the Chat box is hidden in your current Page initiatively. Whenever a new message comes from the User, you are chatting with, the Chat box will pop up with the new message and possible previous messages.
To send messages, simply input your messages in the message input box first, and then press the Enter key. Your messages will appear starting with the keyword, Me, in the message box, and the messages sent by the other Users will appear starting with their User names.
|A practical guide to building a complete corporate intranet with Liferay|
eBook Price: ₨1,108.00
Book Price: ₨1,848.00
How Does It Work?
Liferay Chat portlet (AJAX Instant Messaging) allows Users to automatically chat over XMPP (Jabber) protocol with other Users. Instant Messaging lets members interact with other members in real time. A private room may exists for customers which could give them access to others.
Liferay Chat portlet integrates with a Jabber server, that is, OpenFire. This session will introduce Instant Messaging, AJAX, and Jabber (OpenFire).
OpenFire (previously known as Wildfire Server) is a real-time collaboration (RTC) server, adopted open protocol for instant messaging, XMPP (also called Jabber). URL: http://www.jivesoftware.com/products/openfire/.
Use Instant Messaging
Instant messaging (IM) acts as a form of real-time communication among Users, based on typed text. It allows easy collaboration. In contrast to email, the participants know whether the peer is available. Conversations by instant messaging can be saved for later reference.
One of the Instant Messaging protocols is Extensible Messaging and Presence Protocol (XMPP).
XMPP is an open, XML-inspired protocol for near-real-time, extensible instant messaging (IM) and presence information. It is the core protocol of the Jabber Instant Messaging and Presence technology. URL: http://www.xmpp.org/.
On the one hand, XMPP is based on open standards, different from other instant messaging protocols. Similar to email, XMPP is an open system where a User having a domain name and a suitable Internet connection can run a Jabber server, and talk to others on other servers.
On the other hand, another useful feature of the XMPP system is, transports, also called gateways. Through this, Users can access networks using other protocols. These protocols can be other instant messaging protocols, such as SMS or Email. The case is different from multi-protocol clients, as Users can access XMPP server at the server level. That is, it communicates with other servers through gateway services, which are running on a remote server.
Another interesting feature of XMPP is the HTTP binding behind restricted firewalls.
For instance, Community A User wants to chat with Community B User. Community A User and Community B User have accounts on the Jabber Server and the Third Part Server respectively. When Community A User types in and sends his/her message, a sequence of events is set in action, as shown in the following figure:
- Community A User's client sends his/her message to the Jabber Server.
- If Third Part Server is blocked on Jabber Server, the message is dropped.
- The Jabber Server opens a connection to the Third Part Server.
- The Jabber server delivers the message to Community B User.
- If Jabber Server is blocked on Third Part Server, the message is dropped.
- If Community B User is not currently connected, the message is stored for later delivery.
Jabber is the Linux of instant messaging—an open, secure, ad-free alternative to consumer IM services. URL: http://www.jabber.org/
In other words, AJAX acts as an asynchronous data transfer mechanism, that is, HTTP requests, between the browser and the portal server, allowing portal Pages to request a few bits of information from the server, instead of whole portal Pages. The AJAX makes portal applications smaller, faster and more user-friendly as shown in the following figure:
In general, AJAX is based on the following standards:
- XML—Extensible Markup Language
- XHTML (or HTML)—Extensible Hypertext Markup Language
- CSS—Cascading Style Sheets
AJAX follows web standards supported by all major browsers. Thus, AJAX applications are browser and platform independent. The main advantage of AJAX is the separation of data, format, style, and function.
Using Chat Portlet Effectively
The Chat portlet allows Users to chat over XMPP protocol with other logged-in Users automatically. In order to use the Chat portlet effectively, let's set up an XMPP server and configure Liferay.
Set up XMPP Server
First, we have to set up a XMPP (Jabber) server. Suppose that we use OpenFire as an XMPP (Jabber) server. Here are the steps to set up OpenFire as follows:
- Create a folder, and name it OpenFire.
- Download the OpenFire.
- Extract the file to the OpenFire folder.
- Open the OpenFire folder and furthermore, bin.
- Click on openfire_x_x_x.exe or unzip openfire_x_x_x.tar.gz.
- Click Launch Admin.
- Proceed with configuring OpenFire based on your requirements, as shown in the following figure.
Then, you need to configure the XMPP server (such as OpenFire) with Liferay. You can simply open portal-ext.properties at $LIFERAY_ROOT/webapps/Root/WEB-INF/classes.
You just enter the following lines (Suppose that OpenFire and Liferay are on the same server):
If you want to configure the integration by default settings, here are some options. The following is the complete set of properties related to the setup of XMPP server.
You can also configure the Chat portlet when XMPP server is on a separate server. The following lines are a real example.
Note that you have to turn firewall off in Windows for the Chat Portlet to run properly.
In this article we discussed how to add a participant for chatting, how to manage (view and delete) participants in the Chat portlet, how to start chatting, and how to set up the Chat portlet.
|A practical guide to building a complete corporate intranet with Liferay|
eBook Price: ₨1,108.00
Book Price: ₨1,848.00
About the Author :
Jonas X. Yuan is a Chief Architect of ForgeLife LLC and an expert on Liferay Portal, e-commerce, and Content Management Systems (CMS). As an open source community contributor, he has published five Liferay books from 2008 to 2012. He is also an expert on Liferay integration with Ad Server OpenX, different search engines, enterprise content including videos, audio, images, documents, and web contents, and other technologies, such as BPM Intalio and Business Intelligence Pentaho, LDAP, and SSO. He holds a Ph.D. in Computer Science from the University of Zurich, where he focused on Integrity Control in federated database systems.
He earned his M.S. and B.S. degrees from China, where he conducted research on expert systems for predicting landslides. Previously, he worked as a Project Manager and a Technical Architect in Web GIS (Geographic Information System).
He is experienced in Systems Development Lifecycle (SDLC) and has deep, hands-on skills in J2EE technologies. He developed a BPEL (Business Process Execution Language) engine called BPELPower from scratch at the NASA data center. As the chief architect, Dr. Yuan successfully led and launched several large-scale Liferay/Alfresco e-commerce projects for millions of users each month.
He has worked on the following books: Liferay Portal Enterprise Intranets, 2008; Liferay Portal 5.2 Systems Development, 2009; Liferay Portal 6 Enterprise Intranets, 2010; Liferay User Interface Development, 2010; Liferay Portal Systems Development, 2012.