Results 1 to 9 of 9
  1. #1
    Senior Member
    Join Date
    Aug 2014
    Posts
    71

    sending message from client to server (adapter)

    hello

    i use the method SendMessage() to send a message from the ls client to the server adapter but it gives exception "unsupported function".
    then i saw this post and i implement the function "NotifyUserMessage" but the exception still here.

    so how to overcome this problem?

  2. #2
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    1,090
    There must be some minor mistake.
    From your description, I assume that your Metadata Adapter is a remote one.
    To see what happens in more detail, please increase the Server log in the following way:
    - set the "LightstreamerLogger.pump.messages" logger at DEBUG level;
    - set the "com.lightstreamer.adapters.remote" logger at DEBUG level.
    Then restart the Server and show us the log from the restart to the error replication.
    If the log confirms that the Adapter invoked is the expected one, then we can focus on the Remote Adapter side.

  3. #3
    Senior Member
    Join Date
    Aug 2014
    Posts
    71
    this is the log file from lightstreamer restart until the error showed

    Code:
    23-أغس-14 15:12:05,909|INFO |LightstreamerLogger.init         |main                       |Lightstreamer Server 5.1.2 build 1623.14
    23-أغس-14 15:12:05,953|WARN |LightstreamerLogger.init         |main                       |Lightstreamer is running with a Demo license, which has a limit of 20 concurrent users and can be used for evaluation, development, and testing, but not for production. If you need to evaluate Lightstreamer without this user limit, or need any information on the other license types, please contact info@lightstreamer.com
    23-أغس-14 15:12:05,962|INFO |LightstreamerLogger.init         |main                       |Lightstreamer Server starting in Vivace edition.
    23-أغس-14 15:12:05,963|INFO |LightstreamerLogger.external     |Thread-1                   |Instance ID: sCOQtNKbG0qatdZ690M7
    23-أغس-14 15:12:06,089|INFO |LightstreamerLogger.init         |main                       |Started RMI server for JMX on port 8888.
    23-أغس-14 15:12:06,147|INFO |LightstreamerLogger.init         |main                       |Bound RMI Connector for JMX on port 8888 (communication on port 8888).
    23-أغس-14 15:12:06,185|INFO |LightstreamerLogger.init         |main                       |Bound RMI Connector for Platform mbeans on port 8888 (communication on port 8888).
    23-أغس-14 15:12:06,190|INFO |LightstreamerLogger.init         |main                       |SERVER pool size set by default at 10.
    23-أغس-14 15:12:06,284|INFO |LightstreamerLogger.init         |main                       |data_provider element without name attribute; using DEFAULT as the default name.
    23-أغس-14 15:12:06,286|INFO |LightstreamerLogger.init         |Init for DEMO              |Loading Metadata Adapter DEMO
    23-أغس-14 15:12:06,288|INFO |LightstreamerLogger.init         |or PROXY_HELLOWORLD.DEFAULT|Loading Data Adapter PROXY_HELLOWORLD.DEFAULT
    23-أغس-14 15:12:06,288|INFO |LightstreamerLogger.init         |Init for PROXY_HELLOWORLD  |Loading Metadata Adapter PROXY_HELLOWORLD
    23-أغس-14 15:12:06,287|INFO |LightstreamerLogger.init         |Init for DEMO.MONITOR      |Loading Data Adapter DEMO.MONITOR
    23-أغس-14 15:12:06,294|INFO |LightstreamerLogger.init         |Init for DEMO.CHAT_ROOM    |Loading Data Adapter DEMO.CHAT_ROOM
    23-أغس-14 15:12:06,296|INFO |LightstreamerLogger.init         |Init for DEMO.QUOTE_ADAPTER|Loading Data Adapter DEMO.QUOTE_ADAPTER
    23-أغس-14 15:12:06,287|INFO |LightstreamerLogger.init         | for DEMO.PORTFOLIO_ADAPTER|Loading Data Adapter DEMO.PORTFOLIO_ADAPTER
    23-أغس-14 15:12:06,286|INFO |LightstreamerLogger.init         |t for DEMO.SIMPLE_MESSENGER|Loading Data Adapter DEMO.SIMPLE_MESSENGER
    23-أغس-14 15:12:06,295|INFO |LightstreamerLogger.init         |Init for PROXY_HELLOWORLD  |Finished loading Metadata Adapter PROXY_HELLOWORLD
    23-أغس-14 15:12:06,294|INFO |LightstreamerLogger.init         |Init for DEMO.MONITOR      |Finished loading Data Adapter DEMO.MONITOR
    23-أغس-14 15:12:06,313|INFO |.remote.transport.SocketTransport|or PROXY_HELLOWORLD.DEFAULT|Connecting...
    23-أغس-14 15:12:06,315|INFO |.remote.transport.SocketTransport|Notify Socket Connector    |Waiting for a connection on port 6662...
    23-أغس-14 15:12:06,316|INFO |.remote.transport.SocketTransport|uest/Reply Socket Connector|Waiting for a connection on port 6661...
    23-أغس-14 15:12:06,355|INFO |LightstreamerLogger.init         |t for DEMO.SIMPLE_MESSENGER|Finished loading Data Adapter DEMO.SIMPLE_MESSENGER
    23-أغس-14 15:12:06,373|INFO |LightstreamerLogger.init         |Init for DEMO.QUOTE_ADAPTER|Finished loading Data Adapter DEMO.QUOTE_ADAPTER
    23-أغس-14 15:12:06,380|INFO |LightstreamerLogger.init         |Init for DEMO.CHAT_ROOM    |Finished loading Data Adapter DEMO.CHAT_ROOM
    23-أغس-14 15:12:06,380|INFO |LightstreamerLogger.init         |Init for DEMO              |Finished loading Metadata Adapter DEMO
    23-أغس-14 15:12:06,386|INFO |LightstreamerLogger.init         | for DEMO.PORTFOLIO_ADAPTER|Finished loading Data Adapter DEMO.PORTFOLIO_ADAPTER
    23-أغس-14 15:12:08,013|INFO |LightstreamerMonitorText         |Timer-0                    |Total threads = 31, Total heap = 64487424 (free = 49320152), Sessions = 0 (max = 0), New sessions = [+0, -0], Connections = 0 (max = 0), New connections = [+0, -0], In-pool threads = 10, Active threads = 0, Available threads = 10, Queued tasks = 0, Pool queue wait = 0, NIO write queue = 0, NIO write queue wait = 0, NIO write selectors = 0, NIO total selectors = 0, Subscribed items = 0, Inbound throughput = 0 updates/s (pre-filtered = 0), Outbound throughput = 0 updates/s (0 kbit/s, max = 0), Lost updates = 0 (total = 0), Total bytes sent = 0, Client messages throughput = 0 msgs/s (0 kbit/s, max = 0), Total messages handled = 0, Extra sleep = 0, Notify delay = 0
    23-أغس-14 15:12:11,654|INFO |.remote.transport.SocketTransport|uest/Reply Socket Connector|Connected on port 6661
    23-أغس-14 15:12:11,656|INFO |.remote.transport.SocketTransport|Notify Socket Connector    |Connected on port 6662
    23-أغس-14 15:12:11,657|INFO |.remote.transport.SocketTransport|or PROXY_HELLOWORLD.DEFAULT|Connected
    23-أغس-14 15:12:11,658|INFO |LightstreamerLogger.init         |or PROXY_HELLOWORLD.DEFAULT|Finished loading Data Adapter PROXY_HELLOWORLD.DEFAULT
    
    23-أغس-14 15:12:11,832|INFO |mote.request_reply.NotifyReceiver|#1 Notify Receiver         |Notify receiver '#1' starting...
    23-أغس-14 15:12:11,836|INFO |emote.request_reply.RequestSender|#1 Request Sender          |Request sender '#1' starting...
    23-أغس-14 15:12:11,837|INFO |mote.request_reply.NotifyReceiver|#1 Reply Receiver          |Reply receiver '#1' starting...
    23-أغس-14 15:12:11,840|INFO |LightstreamerLogger.init         |main                       |Events pool size set by default at 4.
    23-أغس-14 15:12:11,847|INFO |LightstreamerLogger.init         |main                       |Pump pool size set by default at 4.
    23-أغس-14 15:12:11,857|INFO |LightstreamerLogger.init         |main                       |Lightstreamer on Java Virtual Machine: Oracle Corporation, Java HotSpot(TM) 64-Bit Server VM, 25.20-b23, 1.8.0_20-b26 on Windows 7
    23-أغس-14 15:12:11,857|INFO |LightstreamerLogger.init         |main                       |Lightstreamer Server 5.1.2 build 1623.14 starting...
    23-أغس-14 15:12:11,868|INFO |LightstreamerLogger.init         |main                       |Server "Lightstreamer HTTP Server" listening to *:8080 ...
    23-أغس-14 15:12:12,681|DEBUG|mote.request_reply.NotifyReceiver|#1 Reply Receiver          |Received reply: 'KEEPALIVE'...
    23-أغس-14 15:12:13,681|DEBUG|mote.request_reply.NotifyReceiver|#1 Reply Receiver          |Received reply: 'KEEPALIVE'...
    23-أغس-14 15:12:14,681|DEBUG|mote.request_reply.NotifyReceiver|#1 Reply Receiver          |Received reply: 'KEEPALIVE'...
    23-أغس-14 15:12:15,681|DEBUG|mote.request_reply.NotifyReceiver|#1 Reply Receiver          |Received reply: 'KEEPALIVE'...
    23-أغس-14 15:12:16,681|DEBUG|mote.request_reply.NotifyReceiver|#1 Reply Receiver          |Received reply: 'KEEPALIVE'...
    23-أغس-14 15:12:17,681|DEBUG|mote.request_reply.NotifyReceiver|#1 Reply Receiver          |Received reply: 'KEEPALIVE'...
    23-أغس-14 15:12:17,931|INFO |LightstreamerLogger.requests     |SERVER POOLED THREAD 10    |Serving request: /lightstreamer/create_session.txt --> LS_adapter_set=PROXY_HELLOWORLD&LS_content_length=50000000&LS_report_info=true on "Lightstreamer HTTP Server" from 0:0:0:0:0:0:0:1:2946
    23-أغس-14 15:12:17,965|INFO |LightstreamerLogger.requests     |SERVER POOLED THREAD 8     |Starting new session: S9e9350aa22010fddT1217957 on "Lightstreamer HTTP Server" from 0:0:0:0:0:0:0:1:2946
    23-أغس-14 15:12:18,681|DEBUG|mote.request_reply.NotifyReceiver|#1 Reply Receiver          |Received reply: 'KEEPALIVE'...
    23-أغس-14 15:12:19,681|DEBUG|mote.request_reply.NotifyReceiver|#1 Reply Receiver          |Received reply: 'KEEPALIVE'...
    23-أغس-14 15:12:20,681|DEBUG|mote.request_reply.NotifyReceiver|#1 Reply Receiver          |Received reply: 'KEEPALIVE'...
    23-أغس-14 15:12:21,681|DEBUG|mote.request_reply.NotifyReceiver|#1 Reply Receiver          |Received reply: 'KEEPALIVE'...
    23-أغس-14 15:12:22,681|DEBUG|mote.request_reply.NotifyReceiver|#1 Reply Receiver          |Received reply: 'KEEPALIVE'...
    23-أغس-14 15:12:22,993|INFO |LightstreamerLogger.requests     |SERVER POOLED THREAD 8     |Serving request: /lightstreamer/send_message.txt --> LS_session=S9e9350aa22010fddT1217957&LS_message=fghgfh on "Lightstreamer HTTP Server" from 0:0:0:0:0:0:0:1:2947
    23-أغس-14 15:12:22,997|INFO |LightstreamerLogger.requests     |SERVER POOLED THREAD 8     |Sending message to session: S9e9350aa22010fddT1217957 on "Lightstreamer HTTP Server" from 0:0:0:0:0:0:0:1:2947
    23-أغس-14 15:12:23,000|INFO |LightstreamerLogger.requests     |SERVER POOLED THREAD 8     |Refused request: Session error: Unsupported function on "Lightstreamer HTTP Server" from 0:0:0:0:0:0:0:1:2947
    23-أغس-14 15:12:23,681|DEBUG|mote.request_reply.NotifyReceiver|#1 Reply Receiver          |Received reply: 'KEEPALIVE'...
    23-أغس-14 15:12:24,681|DEBUG|mote.request_reply.NotifyReceiver|#1 Reply Receiver          |Received reply: 'KEEPALIVE'...
    23-أغس-14 15:12:25,559|INFO |LightstreamerLogger.requests     |FOR PUMPS PARKING DESTROYER|Closed session S9e9350aa22010fddT1217957 with internal cause code: 38 (Interrupted).
    23-أغس-14 15:12:25,681|DEBUG|mote.request_reply.NotifyReceiver|#1 Reply Receiver          |Received reply: 'KEEPALIVE'...
    23-أغس-14 15:12:26,682|DEBUG|mote.request_reply.NotifyReceiver|#1 Reply Receiver          |Received reply: 'KEEPALIVE'...
    ..... remain of the post ===> see the following post

  4. #4
    Senior Member
    Join Date
    Aug 2014
    Posts
    71
    * from the client i wrote the following to connect to the lightstreamer and send a message
    Code:
    string pushServerHost = "localhost";
                const int pushServerPort = 8080;
                string pushServerUrl = "http://" + pushServerHost + ":" + pushServerPort;
    
    
    
    
                ConnectionInfo _cInfo = new ConnectionInfo();
                _cInfo.PushServerUrl = pushServerUrl;
                _cInfo.Adapter = "PROXY_HELLOWORLD";
    
    
    
    
                LSClient client = new LSClient();
                //client.SendMessage("fghgfh");
                client.OpenConnection(_cInfo, new ConnectionListener());
                client.SendMessage("message");



    * the adapter launcher code as following
    Code:
    DataProviderServer server = new DataProviderServer();
                server.Adapter = new HelloWorldAdapter();
    
    
    
    
                TcpClient reqrepSocket = new TcpClient(host, 6661);
                server.RequestStream = reqrepSocket.GetStream();
                server.ReplyStream = reqrepSocket.GetStream();
    
    
    
    
                TcpClient notif_Socket = new TcpClient(host, 6662);
                server.NotifyStream = notif_Socket.GetStream();
    
    
    
    
                server.Start();







    * the adapter inherites the class LiteralBasedProvider and i implement all the methods of it as folllow


    Code:
    public class HelloWorldAdapter :LiteralBasedProvider,IDataProvider
    {
        private IItemEventListener _listener;
    
    
    
    
    
    
    
    
        public void Init(IDictionary parameters, string configFile)
        {
            //throw new NotImplementedException();
    
    
    
    
        }
    
    
    
    
        public bool IsSnapshotAvailable(string itemName)
        {
            //throw new NotImplementedException();
            return false;
        }
    
    
    
    
        public void SetListener(IItemEventListener eventListener)
        {
            //throw new NotImplementedException();
            _listener = eventListener;
        }
    
    
    
    
        public void Subscribe(string itemName)
        {
            Class1 obj = new Class1();
            obj._listener = _listener;
            obj._id = itemName.Replace("item", "");
            Thread t = new Thread(new ThreadStart(obj.Run));
            t.Start();
        }
    
    
    
    
        public void Unsubscribe(string itemName)
        {
            //throw new NotImplementedException();
        }
    
    
    
    
    
    
    
    
        public override int GetAllowedBufferSize(string user, string item)
        {
            throw new NotImplementedException();
        }
    
    
    
    
        public override double GetAllowedMaxBandwidth(string user)
        {
            throw new NotImplementedException();
        }
    
    
    
    
        public override double GetAllowedMaxItemFrequency(string user, string item)
        {
            throw new NotImplementedException();
        }
    
    
    
    
        public override int GetDistinctSnapshotLength(string item)
        {
            throw new NotImplementedException();
        }
    
    
    
    
        public override string[] GetItems(string user, string sessionID, string group)
        {
            throw new NotImplementedException();
        }
    
    
    
    
        public override double GetMinSourceFrequency(string item)
        {
            throw new NotImplementedException();
        }
    
    
    
    
        public override string[] GetSchema(string user, string sessionID, string id, string schema)
        {
            throw new NotImplementedException();
        }
    
    
    
    
        public override bool IsModeAllowed(string user, string item, Mode mode)
        {
            throw new NotImplementedException();
        }
    
    
    
    
        public override bool ModeMayBeAllowed(string item, Mode mode)
        {
            throw new NotImplementedException();
        }
    
    
    
    
        public override void NotifyNewSession(string user, string sessionID, IDictionary clientContext)
        {
            throw new NotImplementedException();
        }
    
    
    
    
        public override void NotifyNewTables(string user, string sessionID, TableInfo[] tables)
        {
            throw new NotImplementedException();
        }
    
    
    
    
        public override void NotifySessionClose(string sessionID)
        {
            throw new NotImplementedException();
        }
    
    
    
    
        public override void NotifyTablesClose(string sessionID, TableInfo[] tables)
        {
            throw new NotImplementedException();
        }
    
    
    
    
        public override void NotifyUser(string user, string password, IDictionary httpHeaders, string clientPrincipal)
        {
            throw new NotImplementedException();
        }
    
    
    
    
        public override void NotifyUser(string user, string password, IDictionary httpHeaders)
        {
            throw new NotImplementedException();
        }
    
    
    
    
        public void NotifyUserMessage(string user, string sessionID, string message)
        {
            throw new NotImplementedException();
        }
    
    
    
    
        public bool WantsTablesNotification(string user)
        {
            throw new NotImplementedException();
        }
    }



    after doing that i still have the same exception message "unsupported function" on this line client.SendMessage("message");

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

    The issue is in the NotifyUserMessage implementation:



    the "Unsuopported function" message is in fact caused by the NotImplementedException thrown in the above method.
    Replace the exception with the implementation handling the received message and you should be fine.

  6. #6
    Senior Member
    Join Date
    Aug 2014
    Posts
    71
    i am already delete the throw lines and implement the function but the message "Unsupported function" still showed

  7. #7
    Power Member
    Join Date
    Jul 2006
    Location
    Cesano Maderno, Italy
    Posts
    784
    Then that remote metadata is not the one receiving the sendMessge request.

    Please attach here the adapters.xml file that is located in the folder of you remote adapter (usually in the LS_HOME/adapters/your_adapter_folder )

  8. #8
    Senior Member
    Join Date
    Aug 2014
    Posts
    71
    this is the adapter.xml

    Code:
    <?xml version="1.0"?>
    
    
    <adapters_conf id="PROXY_HELLOWORLD">
    
    
        <metadata_provider>
            
    
    
    <adapter_class>com.lightstreamer.adapters.metadata.LiteralBasedProvider</adapter_class>
    
    
        
        </metadata_provider>
    
    
    
    
        <data_provider>
    
    
    <adapter_class>com.lightstreamer.adapters.remote.data.NetworkedDataProvider</adapter_clas
    
    
    s>
    
    
            
            <param name="request_reply_port">6661</param>
    
    
            <param name="notify_port">6662</param>
    
    
    
    
        </data_provider>
    
    
    </adapters_conf>

  9. #9
    Power Member
    Join Date
    Jul 2006
    Location
    Cesano Maderno, Italy
    Posts
    784
    Ok,
    the issue is that the metadata adapter in use is not your remote adapter but the local LiteralBasedProvider


    You should replace that section with something like



    (obviously the configured port must be the one used by your remote metadata adapter, I used 6663 as an example)

    You might want to refer to the following demo that shows both a remote adapter and a remote metadata adapter: https://github.com/Weswit/Lightstrea...adapter-dotnet

    As a final note, implementing both data adapter and metadata adapter in a single class will make your init method to be called twice. HTH.

 

 

Similar Threads

  1. Replies: 12
    Last Post: May 26th, 2014, 10:59 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. Sending an image to the client
    By mnanda in forum Client SDKs
    Replies: 2
    Last Post: July 16th, 2010, 12:04 PM
  4. LS not sending all messages to client
    By mnenchev in forum General
    Replies: 3
    Last Post: April 20th, 2010, 10:10 AM
  5. sending multiple snapshot (true) event in smartUpdate()
    By Pradeep Chahal in forum Adapter SDKs
    Replies: 6
    Last Post: October 12th, 2009, 01:25 PM

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 07:24 PM.