Skip to content

Lightstreamer/Lightstreamer-example-Messenger-client-javascript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lightstreamer - Basic Messenger Demo - HTML Client

This project includes a simple web client front-end example for the Lightstreamer - Basic Messenger Demo - Java Adapter.

  
</td>
<td>
  &nbsp;An online demonstration is hosted on our servers at:<br>
  &nbsp;<a href="http://demos.lightstreamer.com/MessengerDemo" target="_blank">http://demos.lightstreamer.com/MessengerDemo</a>
</td>

The Basic Instant Messenger Demo shows an extremely simple version of a typical messenger, where messages can be delivered to a specific friend, chosen from a dynamic list of online buddies.
Choose a nick-name and click Login. You will see a list of all users connected to this demo, with their nicknames. Write a message and choose a recipient. The message will be delivered only to him/her (rather than broadcasting it, as the Lightstreamer - Basic Chat Demo - HTML Client does).

Launch multiple instances of the demo, possibly on different machines, to populate the Buddies list. If you use the same nick-name on different instances, you will actually embody the same identity (to keep things simple, no authentication is used).

The front-end code can be considered a reference example of one-to-one messaging. Each user subscribes to their personal item (corresponding to the nick-name), so that messages can be routed properly, instead of begin broadcast (as in the Lightstreamer - Basic Chat Demo - HTML Client, where all the users subscribe to the same item). In real applications, where authentication is used, the Metadata Adapter should enforce the association between the user's identity and the item they have the right to subscribe to.

The demo includes the following client-side technologies:

Deploy

Before you can run the demo some dependencies need to be solved:

  • Get the lightstreamer.js file from the latest Lightstreamer distribution and put it in the src/[demo_name]/js folder of the demo (if that is the case, please create it). Alternatively you can build a lightstreamer.js file from the online generator. In that case be sure to include the LightstreamerClient, Subscription, DynaGrid, and StatusWidget modules and to use the "Use AMD" version.
  • Get the require.js file form requirejs.org and put it in the src/[demo_name]/js folder of the demo.

You can deploy this demo in order to use the Lightstreamer server as Web server or in any external Web Server you are running. If you choose the former case please note that in the <LS_HOME>/pages/demos/ folder there is a copy of the /src directory of this project, if this is non your case please create the folders <LS_HOME>/pages/demos/MessengerDemo then copy here the contents of the /src folder of this project.
The client demo configuration assumes that Lightstreamer Server, Lightstreamer Adapters and this client are launched on the same machine. If you need to targeting a different Lightstreamer server please search this line:

var lsClient = new LightstreamerClient(protocolToUse+"//localhost:8080","MESSENGER");

in js/lsClient.js file and change it accordingly.
Anyway the SIMPLE_MESSENGER and IMMetadataAdapter Adapters have to be deployed in your local Lightstreamer server instance. The factory configuration of Lightstreamer server already provides this adapter deployed.
The demo are now ready to be launched.

See Also

Lightstreamer Adapters needed by this demo client

Similar demo clients that may interest you

Lightstreamer Compatibility Notes

  • Compatible with Lightstreamer JavaScript Client library version 6.0 or newer.

About

The Basic Instant Messenger Demo shows an extremely simple version of a typical messenger

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 5