Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[leshan-dev] use of Leshan API for notifications

Hi All,

I have created a sample listener on Java client side which talks to server side servlets to get the client details and the objects associated with it.

In my setup Eclipse LehanServerDemo is running @10.37.14.XX
My web application(talking to rest server) is running on 10.37.15.XX

In my rest server, I get the clients connected by running the below  code. Now how can my rest server notified when there is any new client connects to the server? or when the client updates the IPSO objects.
I dont want do any polling from the REST server or the application side to get the updates.

How can lesh server notify ?

Code:
URL url = "" URL("http://10.37.14.XX:8080/api/clients");
           URLConnection conn = url.openConnection();
           conn.setDoOutput(true);
           System.out.println("Connected");
           
                     BufferedReader in = 
               new BufferedReader( new InputStreamReader( conn.getInputStream() ) );
           
           String response;
           while ( (response = in.readLine()) != null ) {
               System.out.println( response );
           }
           in.close();

Back to the top