Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17
  1. #11
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    1,090
    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.

  2. #12
    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?

  3. #13
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    1,090
    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.

  4. #14
    Senior Member
    Join Date
    Sep 2007
    Location
    des plaines
    Posts
    41
    Ok, while I was creating MessageAwareLiteralBasedProvider class:
    using System;
    using System.Collections;
    using System.Threading;
    using System.Net;
    using System.Net.Sockets;
    using System.Text;

    using Lightstreamer.Interfaces.Metadata;

    public class MessageAwareLiteralBasedProvider : IMetadataProvider
    {
    public void NotifyUserMessage(string user, string session, string message)
    {
    }
    }
    I was forced to specify many more functions. Is that right?

  5. #15
    Power Member
    Join Date
    Jul 2006
    Location
    Cesano Maderno, Italy
    Posts
    784
    hi,

    yes it's correct because you are implementing the IMetadataProvider interface and so you have to implement all the methods declared in the interface

    maybe you want to write your class extending the LiteralBasedProvider so that you can re-implement just the NotifyUserMessage method

    HTH

  6. #16
    Senior Member
    Join Date
    Sep 2007
    Location
    des plaines
    Posts
    41
    Yes, I did that, compiler did not ask for other functions. But I haven't tested sending message yet.

    This is the code from HelloWorld .Net adapter sample:
    public void Run()
    {
    go = true;
    int c = 0;
    Random rand = new Random();

    while (go)
    {
    IDictionary eventData = new Hashtable();
    eventData["message"] = c % 2 == 0 ? "Hello" : "World";
    eventData["timestamp"] = DateTime.Now.ToString("s");
    _listener.Update("greetings", eventData, false);
    c++;
    Thread.Sleep(1000 + rand.Next(2000));
    }
    }

    This while loop. Does LS need it or it just mimics a constant data feed?

    Thanks

  7. #17
    Power Member
    Join Date
    Jul 2006
    Location
    Cesano Maderno, Italy
    Posts
    784
    hi,

    that code just publishes an update each 1000 + rand.Next(2000) milliseconds.
    Lightstreamer doesn't need such loop, you should implement your own logic to send updates related to your feed

    HTH

 

 

Similar Threads

  1. Don't send message when refresh the browser
    By naitsir in forum Client SDKs
    Replies: 7
    Last Post: October 2nd, 2012, 11:36 AM
  2. How to send message to each client?
    By hungtt in forum Adapter SDKs
    Replies: 7
    Last Post: December 30th, 2010, 04:42 AM
  3. Replies: 9
    Last Post: October 19th, 2009, 05:02 PM
  4. How to send params from client to server
    By kanibal210 in forum Client SDKs
    Replies: 1
    Last Post: September 30th, 2009, 09: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 05:57 PM.