Results 1 to 10 of 17

Hybrid View

  1. #1
    Senior Member
    Join Date
    Sep 2007
    Location
    des plaines
    Posts
    41
    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.

  2. #2
    Power Member
    Join Date
    Jul 2006
    Location
    Cesano Maderno, Italy
    Posts
    784
    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.

  3. #3
    Senior Member
    Join Date
    Sep 2007
    Location
    des plaines
    Posts
    41
    Ok, the exact message is:
    <INFO> Refused Request: Session error: Unsupported function from ipxxxx : xxxxport

    This is my function from the push page:
    function sendMessage(message)
    {
    debugger;
    ls.sendMessage(message);
    }
    and I am calling that function from Flex.

    When it goes into debug the ls is the LS Engine object. So, that''s not a problem.
    I think I need to do something on the server to make it work. Looks like it is the last piece of the puzzle to have my solution working.
    Here is my .net code:
    DataProviderServer server = new DataProviderServer();
    server.Adapter = new SocketToLightStreamer();

    MetadataProviderServer serverMeta = new MetadataProviderServer();
    serverMeta.Adapter = new Lightstreamer.Adapters.Metadata.LiteralBasedProvid er();

    TcpClient reqrepSocket = new TcpClient(host, reqrepPort);
    server.RequestStream = reqrepSocket.GetStream();
    server.ReplyStream = reqrepSocket.GetStream();

    TcpClient notifSocket = new TcpClient(host, notifPort);
    server.NotifyStream = notifSocket.GetStream();

    server.Start();

    I am trying to understand what you are suggesting about both data adapter and meta data adapter working together but still not sure how to do that.

    Thanks for your help.

  4. #4
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    1,091
    Ok, sorry, the error was server side, on the LS console.
    The reported message is issued by the default Remote Metadata Adapter (i.e. the LiteralBasedProvider) upon a client message.
    In fact, there is no default implementation for NotifyUserMessage.
    You have to code a custom Remote Metadata Adapter and use it in place of the LiteralBasedProvider (you can, however, inherit from LiteralBasedProvider).
    There, you can put your own implementation for NotifyUserMessage.
    (I had to correct again some previous posts; in the .NET interface, the method name starts with a capital letter).

    As said in a previous post, your Remote Metadata Adapter should then communicate with your Remote Data Adapter. The best way to achieve this is to run both adapters in the same process. There is no direct support for this, but the provided "StandaloneLauncher.cs" shows an example of a program doing this by leveraging the Lightstreamer.DotNet.Server interface.

  5. #5
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    1,091
    About Metadata Adapter and Data Adapter communication, this is no longer a problem,
    as I see that you have already set up a Remote Server based on on the "StandaloneLauncher.cs" example.
    This means that your code already creates an object of the custom class "SocketToLightStreamer" as the Data Adapter and,
    as said in the previous post, it should create an object of some custom class (let's call it "MessageAwareLiteralBasedProvider") as the Metadata Adapter.
    Then you just need to make the MessageAwareLiteralBasedProvider object, upon a NotifyUserMessage call, invoke some method on the SocketToLightStreamer object, so as to instruct the latter to send some update.

  6. #6
    Senior Member
    Join Date
    Sep 2007
    Location
    des plaines
    Posts
    41
    <it should create an object of some custom class (let's call <it "MessageAwareLiteralBasedProvider") as the Metadata Adapter.
    You mean like this:
    MetadataProviderServer MessageAwareLiteralBasedProvider = new MetadataProviderServer();
    MessageAwareLiteralBasedProvider.Adapter = new Lightstreamer.Adapters.Metadata.LiteralBasedProvid er();
    If yes, then how do I override its NotifyUserMessage?

  7. #7
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    1,091
    No, in
    let's call it "MessageAwareLiteralBasedProvider"
    "it" referred to the class (by the way, is it bad english?);
    I meant that you should create a class named MessageAwareLiteralBasedProvider and load it as:
    Code:
    MetadataProviderServer serverMeta = new MetadataProviderServer();
    serverMeta.Adapter = new MessageAwareLiteralBasedProvider();
    That class inherits from Lightstreamer.Adapters.Metadata.LiteralBasedProvid er and, in addition, implements the NotifyUserMessage method.

 

 

Similar Threads

  1. Don't send message when refresh the browser
    By naitsir in forum Client SDKs
    Replies: 7
    Last Post: October 2nd, 2012, 10:36 AM
  2. How to send message to each client?
    By hungtt in forum Adapter SDKs
    Replies: 7
    Last Post: December 30th, 2010, 03:42 AM
  3. Replies: 9
    Last Post: October 19th, 2009, 04:02 PM
  4. How to send params from client to server
    By kanibal210 in forum Client SDKs
    Replies: 1
    Last Post: September 30th, 2009, 08:36 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT +1. The time now is 02:36 PM.