-
June 25th, 2008, 11:05 AM
#1
Hi Mark,
Currently you cannot talk directly to the Data Adapter from the client, but you can talk to the Metadata Adapter, through the sendMessage method. The Metadata Adapter will receive a call to notifyUserMessage. Then, the Metadata Adapter could talk to the Data Adapter.
Consider that for enterprise applications, you will probably have a cluster of Lightstreamer Servers and you may want to leverage a server-side middleware (e.g. JMS) to dispatch messages to all your Data Adapters. In this case, you will probably deliver messages from the client to a typical web server component (e.g. a servlet), which will publish the data to the messaging bus. And the Data Adapters will listen to this bus.
-
June 25th, 2008, 02:35 PM
#2
Does that require Java backend?
I am running .Net data Adapter though. Will it work then? If yes, could you please show some sample code?
Thanks
-
June 26th, 2008, 08:56 AM
#3
The simple technique (i.e. sendMessage + notifyUserMessage + Metadata/Data Adapter communication) is also available with Remote .NET Data Adapters.
You should code your Metadata Adapter as a Remote .NET Adapter too ("NotifyUserMessage" is still provided by the .NET library interface).
Then you can have your Remote Metadata and Data Adapter talk to each other quite easily by loading them in the same Remote Server instance. This is shown in DOCS-SDKs\sdk_adapter_dotnet; see chapter 1.6 in doc\DotNet Adapters.pdf. The sample code shows loading both adapters, though communication between them is not covered.
The full technique (i.e. an intermediate servlet and a message bus) is entirely played outside Lightstreamer. We use it in the PortfolioDemo; see http://www.lightstreamer.com/portfolioDemo.htm, where some raw code is available for the java case.
-
July 16th, 2008, 11:08 PM
#4
But isn't sendMessage a server side method?
How am I triggering it from the client (Browser)?
Thanks
-
July 17th, 2008, 08:48 AM
#5
No, sorry for the confusion; I have now fixed my previous post.
sendMessage is provided by the Web Client Library as a method of the LightstreamerEngine object
http://www.lightstreamer.com/docs/cl...ml#sendMessage
A call to sendMessage by your client triggers, on the server side, the invocation of the notifyUserMessage method on your Metadata Adapter; this is supported both for java adapters and (as NotifyUserMessage) for remote .NET adapters.
-
July 17th, 2008, 04:42 PM
#6
How do I override notifyUserMessage to have my code there?
Also here is a fragment of my push page:
ls = "";
page.onEngineCreation = function(lsEngine) {
lsEngine.connection.setLSHost("UFD-SQL2008TEST.ufandd.local");
lsEngine.connection.setLSPort(8080);
lsEngine.context.setDebugAlertsOnClientError(debug Alerts);
lsEngine.context.setRemoteAlertsOnClientError(remo teAlerts);
lsEngine.connection.setAdapterName("PROXY_HELLOWOR LD");
lsEngine.changeStatus("STREAMING");
ls = lsEngine;
}
page.bind();
page.createEngine("HelloWorldApp", "LS", "SHARE_SESSION");
var pushtable = new NonVisualTable(["floorupdate"], ["scan"], "MERGE");
page.addTable(pushtable, "hellotable");
pushtable.onItemUpdate =
function(itemPos, updateInfo, itemName)
{
// send completed scan to the front-end
if (updateInfo.getNewValue(itemPos) != "")
{
serverData(updateInfo.getNewValue(itemPos));
}
};
function sendMessage(message)
{
ls.sendMessage(message);
}
After fireing ls.sendMessage(message) LS console shows an error "unknown function" or something.
Am I too far from what I am looking for (sending message back to server)?
Thanks for your patience.
-
July 18th, 2008, 09:28 AM
#7
hi,
After fireing ls.sendMessage(message) LS console shows an error "unknown function" or something.
Am I too far from what I am looking for (sending message back to server)?
are you sure that you call the sendMessage method only once the ls object is initiated?
The error you're receiving tells you that the object does not have such method and this make sense because before being a LightstreamerEngine instance your ls variable contains a string
for a quick check try to start with a null ls variable. The error message should change.
let me know if I'm wrong.
Similar Threads
-
By naitsir in forum Client SDKs
Replies: 7
Last Post: October 2nd, 2012, 10:36 AM
-
By hungtt in forum Adapter SDKs
Replies: 7
Last Post: December 30th, 2010, 03:42 AM
-
By naitsir in forum Client SDKs
Replies: 9
Last Post: October 19th, 2009, 04:02 PM
-
By kanibal210 in forum Client SDKs
Replies: 1
Last Post: September 30th, 2009, 08:36 AM
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 03:48 PM.
Bookmarks