-
April 2nd, 2007, 07:01 AM
#1
User Specific Response
Hi Guys,
In the first place, my congratulations for giving us access to the bleeding edge of technologies with your framework.
We are planning to use LightstreamerPush for a messaging kind of application. So there will be many connected users and every user will have the option of sending data to other online users. The client application will be mostly in PHP along with Dojo. Will use PHPMQ to communicate to Push Server adapter.
So my understanding so far on pieces of code we should be implementing (pls correct me if I am wrong) -
DataProvider - The implementation that will manage all users and receive their messages.
JMSAdapter - The implementation that will receive messages over JMS for DataProvider
MetaDataProvider - The implementation that will use the username, password info in getItems function to provide user specific handling.
My doubt with MetaDataProvider, I saw both your implementations, basically getItems
is called only once when loading the dataprovider for the user and not every time the data is sent to the user.
How do I implement user specific behavior, basically I need to push messages to him only when it is intended for him. Stating it differently, I need to receive all messages and see if a user has subscribed for the particular username, if so I need to push the message to him. In which function and class should I keep the code for this functionality.
Thanks in advance,
Vishnu
-
April 3rd, 2007, 10:27 AM
#2
Hi,
Some clarifications are needed:
DataProvider - The implementation that will manage all the updates both for common items and user-specific items.
MetaDataProvider - The implementation that will use the username, password info in getItems function to provide user specific handling customizing general item names to user-specific ones.
JMSAdapter - Just a specific DataProvider implementation used as example in our distribution that receives messages over JMS.
You can take a look to the javadocs of MetadataProvider and DataProvider, to the "General Concept.pdf" file (find it under the DOCS-SDKs folder of the distribution) and to the User-specific push thread for further clarifications.
-
April 3rd, 2007, 10:44 AM
#3
Vishnu,
Thanks for using Lightstreamer.
The easiest way to achieve your required behavior is that each user subscribes to a unique itemname (perhaps bound to his username). Then, when another user posts a message for him, the Data Adapter will publish such message as an update to that specific itemname. You can deliver the messages to your Data Adapter in a couple of ways:
- by using the sendMessage function (that delivers the message to the Metadata Adapter, that in turns can send it to the Data Adapter)
- by sending the message to an external server-side component (e.g. PHP page, servlet, etc.) that in turns sends the message to the Data Adapter (through JMS, sockets, db, etc.). You can see an example in the Portfolio Demo code (http://www.lightstreamer.com/portfolioDemo.htm).
Cheers
-
April 5th, 2007, 06:06 PM
#4
Thanks
Hi Friends,
Thanks a lot for your support. I m now able to understand the architecture.
For my case, I just pass the name of the user to the adapter (to which it is subscribed). The server manages sending it only to him.
I have two more questions -
1) I tried modifying the engine creation to include username/password as follows
engineRef.context.setDebugAlertsOnClientError(debu gAlerts);
engineRef.context.setRemoteAlertsOnClientError(tru e);
engineRef.connection.setUserName("cookie");
engineRef.connection.setPassword("password");
engineRef.connection.setLSHost(host);
engineRef.connection.setLSPort(port);
engineRef.connection.setAdapterName("STOCKLISTJMSD EMO");
engineRef.changeStatus("STREAMING");
but I always get null for username argument in the following functions
LiteralBasedProvider::getItems
LiteralBasedProvider::getSchema
and username/password is null in the following function
LiteralBasedProvider::notifyUser
Am I going wrong somewhere?
2) Is there any other way of creating a client implementation to subscribe and receive messages from the server without using NonVisualTable control?
Thanks,
Vishnu
-
April 6th, 2007, 11:06 AM
#5
Hi Vishnu
The username argument is supposed not to be passed as null in this case.
Is it possible that the Engine is already streaming when "setUserName" is called?
Are you using "createEngine" or the old "loadEngine" in order to load the Engine?
May you please check Lightstreamer Server log? You should be able to find your username logged.
I Assume that, in your second question, you are looking for an alternative to using "NonVisualTable" still in the context of an HTML front-end. Then the answer is no; subscribing to items is only made through the definition of a table object.
Other types of table objects do exist, as listed in the Javascript API JSDocs: they all are "visual tables" and can be used in order to take advantage of Lightstreamer-provided management of the visualization of the data in the table cells.
Dario
Similar Threads
-
By leonardodar in forum Adapter SDKs
Replies: 3
Last Post: March 16th, 2011, 09:45 AM
-
By zeos in forum Adapter SDKs
Replies: 1
Last Post: January 28th, 2010, 09:41 AM
-
By mnenchev in forum Adapter SDKs
Replies: 5
Last Post: September 1st, 2009, 09:36 AM
-
By sundaramlaxman in forum Client SDKs
Replies: 4
Last Post: February 21st, 2007, 02:11 PM
-
By rmusco in forum General
Replies: 8
Last Post: February 2nd, 2007, 05:29 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
All times are GMT +1. The time now is 05:47 PM.
Bookmarks