Simple Instant messaging client
When the “createBox” button is clicked, we want the box to pop up, and to be able to enter in communication with the remote client.
With our IMClient created and our box open, we can now send messages to the remote client. After the users enters a message, the following function is executed to send it.
A symmetrical behavior is then expected of the remote client, which has also created it’s IMClient, and has registered an event handler with the event “receiveIMMessage”. The receiveIMMessageHandler function initializes the IMClient if necessary, and then displays the message received.
The communication is now established between the two clients, and they can continue exchanging messages. To go further, you can also check our group chat example.