Results 1 to 8 of 8
  1. #1
    Member
    Join Date
    May 2010
    Location
    HCM
    Posts
    9

    Post How to send message to each client?

    Hi All,
    I want to use Messeger Demo of Java to apply for DotNet? How to config adapter, implement MetadataProvider and DataAdapter to send private message to client?
    Thanks!

  2. #2
    Power Member
    Join Date
    Jul 2006
    Location
    Cesano Maderno, Italy
    Posts
    784
    Hi,

    try to check out the .NET version of the PortfolioDemo (available in our distribution under LS_HOME/DOCS-SDKs/sdk_adapter_dotnet/examples/Remote_Portfolio_Adapters).
    That demo was directly ported from the Java version, you should do the same with the MessengerDemo.

    Let me know if and where you get stuck.

  3. #3
    Member
    Join Date
    May 2010
    Location
    HCM
    Posts
    9
    Thank for the reply.
    Could you explain about the prameters of metadata_provider? And When I configure the info of metada_provider (match_id, tem_family, ...) on "adapters.xml" file, I don't recieve that parameters on "Init" function of MetadataProviderAdapter.
    Thanks.

  4. #4
    Power Member
    Join Date
    Jul 2006
    Location
    Cesano Maderno, Italy
    Posts
    784
    writing a .NET adapter you don't need to use the match_id to match your metadata adapter and your data adapter;
    Check the class StandaloneAdaptersLauncher in the folder LS_HOME/DOCS-SDKs/sdk_adapter_dotnet/examples/Remote_Portfolio_Adapters/src_standalone_launcher . There the metadata adapter and the data adapter are instantiated and "connected" through the setFeed calls.

    Before that, command line parameters are parsed and then passed to the init methods. So, if you need to add custom parameters you can do that by acting on the bat file ( LS_HOME/DOCS-SDKs/sdk_adapter_dotnet/examples/Remote_Portfolio_Adapters/Deployment/Deployment_DotNet_Server(custom) )

    Parameters in the adapters.xml file are only passed to java adapters; In your case those are the parameters used by the remote java adapters to accept data from their .NET counterparts.

    HTH

  5. #5
    Member
    Join Date
    May 2010
    Location
    HCM
    Posts
    9
    Hi Mone! Thanks for the reply, I've connected between metadata adapter and the data adapter through the setFeed. On the web client, I use "DynaScrollTable" to recieve messages from the "NotifyUserMessage" function on the metada adapter. Here is my code:
    Code:
                   var group = "im_" + userName;
    			var schema = ["fromNick", "toNick", "message"];			
    			var imTable = new DynaScrollTable(group, schema, "DISTINCT");			
    			imTable.setDataAdapter("PROXY_HS_MARKETDATA");
    			imTable.setSnapshotRequired(false);			
    			imTable.setPushedHtmlEnabled(false); 
    			imTable.setMaxDynaRows("unlimited");
    			imTable.setUpwardScroll(true);
    imTable.setAutoScroll("ELEMENT","message_scroll"); 									
    			imTable.onChangingValues = function(domNode, visualUpdateInfo) {			 
    			  if (visualUpdateInfo != null) {
    				var from = visualUpdateInfo.getServerValue("fromNick");	
    			//Don't recieve message from DataAdater 	
    				alert(from); 				
    			  }
    			};					
    			pushPage.addTable(imTable, "messages");
    And here is DataAdapter Code:

    Code:
      
    // Call by Metadata to notify to client
    public void sendMessage(string from, string to, string message)
            {
                if (localListener != null)
                {                
                    IDictionary dic = new Hashtable();                                
                    dic.Add("fromNick", from);
                    dic.Add("toNick", to);
                    dic.Add("message", message);  
                    localListener.OnUpdate(dic);                            
                }
            }
    I don't know why the web client doesn't receive any messages.
    Thanks and Regards!

  6. #6
    Power Member
    Join Date
    Jul 2006
    Location
    Cesano Maderno, Italy
    Posts
    784
    please before digging your code did you verify that the environment is correctly configured?
    Are you able to correctly run one of the internal demos?
    Are you able to correctly run the .NET version of the PortfolioDemo?

  7. #7
    Member
    Join Date
    May 2010
    Location
    HCM
    Posts
    9
    Quote Originally Posted by Mone
    please before digging your code did you verify that the environment is correctly configured?
    Are you able to correctly run one of the internal demos?
    Are you able to correctly run the .NET version of the PortfolioDemo?
    Yes, I run and base on PortfolioDemo to develope a demo to send messages one by one client, here is the returned result from server:
    Code:
    30.Dec.10 09:47:39,734 < INFO> Attaching session: S5eff9a610bd223b7T4739671 from
     127.0.0.1:2407
    30.Dec.10 09:47:48,093 < INFO> Serving request: /lightstreamer/control.js --> LS
    _session=S5eff9a610bd223b7T4739671&LS_table=0&LS_win_phase=27&LS_op=add&LS_req_p
    hase=740&LS_mode=DISTINCT&LS_id=im_test&LS_schema=fromNick%20toNick%20message&LS
    _data_adapter=PROXY_HS_MARKETDATA&LS_unique=1& from 127.0.0.1:2402
    30.Dec.10 09:47:48,109 < INFO> Controlling session: S5eff9a610bd223b7T4739671 fr
    om 127.0.0.1:2402
    30.Dec.10 09:48:00,375 < INFO> Serving request: /lightstreamer/send_message.js -
    -> LS_session=S5eff9a610bd223b7T4739671&LS_message=IM%7CFromUser%7Ctest%7CHello&
    LS_req_phase=0&LS_sequence=Messages&LS_max_wait=5000&LS_unique=2& from 127.0.0.1
    :2404
    30.Dec.10 09:48:00,375 < INFO> Sending message to session: S5eff9a610bd223b7T473
    9671 from 127.0.0.1:2404

  8. #8
    Member
    Join Date
    May 2010
    Location
    HCM
    Posts
    9
    Ok, Thanks Mone!
    I have fixed.

 

 

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. Sending a message to the client
    By colmfield in forum Client SDKs
    Replies: 2
    Last Post: August 26th, 2010, 10:52 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
  5. Send data back using LS
    By markgoldin in forum General
    Replies: 16
    Last Post: August 6th, 2008, 11:00 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 11:02 AM.