This project includes a front-end example based on the Chat demo for Lightstreamer JMS Extender
HTML CSS
Permalink
Failed to load latest commit information.
css
images
.gitattributes
.gitignore
LICENSE
README.md
index.html
screen-large.png
screen-small.png

README.md

Lightstreamer JMS Extender - Basic Chat Demo - HTML Client

This project includes a simple JMS-based chat.

Details

The JMS Chat Demo implements an extremely simple chat application, where all the users connected to the page can exchange messages.

Launch multiple instances of the demo, possibly on different machines, to appreciate the message broadcast capability.

This page uses the Lightstreamer JMS Extender JavaScript Client API to handle communications with JMS Extender.

Check out the sources for further explanations.

screenshot

Install

Before you can run the demo of this project, some dependencies need to be solved:

  • Configure the JMS broker as described in the next section.
  • Configure and launch a Lightstreamer JMS Extender instance. Please refer to Lightstreamer web site download page to find the JMS Extender download package.
  • Get the lightstreamer-jms.js file from the Lightstreamer JMS Extender and put it in the root folder of this project.
  • RequireJS is currently hot-linked in the html page: you may want to replace it with a local version and/or to upgrade its version.
  • jQuery is currently hot-linked in the html page: you may want to replace it with a local version and/or to upgrade its version.

JMS Broker

This demo needs a JMS infrastructure to run. You can choose a JMS broker to be used for this example. You should have already configured the JMS connector for your preferred broker by following the JMS Extender documentation. Now it is necessary to create the topic to be used by this demo. We will show 4 examples using HornetQ (AKA JBoss Messaging), TIBCO EMS, Apache ActiveMQ, and JBossMQ. If you already know how to create a topic, go create a "chatTopic" topic and skip this part.

HornetQ (AKA JBoss Messaging)

Open the hornetq-jms.xml located under HornetQHome/config/stand-alone/non-clustered and add the following node:

   <topic name="chatTopic">
      <entry name="chatTopic"/>
   </topic>

TIBCO EMS

Open the topics.conf located under EMSHome/bin/ and append to it the line "chatTopic".

Apache ActiveMQ

There's no need to create the topic because ActiveMQ supports dynamic configuration of destinations.

JBossMQ

Open the jbossmq-destinations-service.xml located under JBossHome/server/default/deploy/jms/ and add the mbean node as shown below:

  <mbean code="org.jboss.mq.server.jmx.Topic"
    name="jboss.mq.destination:service=Topic,name=chatTopic">
    <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
  </mbean>

Configure

Now, you need to configure the index.html of this example by specifying the name of the JMS connector you are going to use. To set the JMS connector name (and possibly the JMS Extender address), modify the following line (as you can see HornetQ is pre-configured):

  TopicConnectionFactory.createTopicConnection("http://localhost:8080/", "HornetQ", null, null, {

Launch

To access the demo from a web browser, copy it somewhere under your webserver root directory. You can also add it to the JMS Extender internal web server pages under JMSExtenderHome/pages directory by copying it there with a folder name such as ChatDemo_JMS. Subsequently you may access it as: http://your_jms_extender_http_address/ChatDemo_JMS/. Depending on the browser in use, and on the security settings, you might also be able to launch the index.html file directly from the file system.

See Also

Related Projects

Lightstreamer Compatibility Notes

  • Compatible with Lightstreamer JMS Extender JavaScript Client library version 1.2 or newer.
  • Compatible with Lightstreamer JMS Extender since version 1.5 or newer.