-
Notifications
You must be signed in to change notification settings - Fork 402
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Observe device from an http client #850
Comments
You mean a http-client for controlling a Leshan server demo ? If I'm right, observe notification is sent by the http server demo to the browser using Server Sent Event At server side see EventServlet. |
Thank you @sbernard31 . |
You need to find how to use Server Sent Event with your http client and that's all. E.g in our javascript application demo this looks like this : // listen for clients registration/deregistration/observe
$scope.eventsource = new EventSource('event?ep=' + $routeParams.clientId);
$scope.eventsource.addEventListener('NOTIFICATION', function(msg) {
// Do your stuff on notification.
}, false); Or I didn't get your question ? 🤔 |
Hey, |
I never played with this python library but my guess is that : You should do something like : messages = SSEClient('http://your.leshan.server.org/event?ep=your_device_endpoint_name'')
for msg in messages:
do_something_useful(msg) This is to listen notifications received from "your_device_endpoint_name". This does NOT established an observe relation but just declare a kind of listener, to ask to LWM2M client to push notification to the LWM2M server, you need to send an observe request from the LWM2M server. |
I guess you are right. but, from what I understood the client doesn't send a request to the server for receiving update from ´http://your.leshan.server.org/event?ep=your_device_endpoint_name´. |
I don't get your point 🤔 Here is how it should works :
|
Maybe I am wrong, but the problem is that I am sending a request to a path and I am receiving response from another path on another http connection without a redirection or nothing. |
😕 Sorry but I still don't get what you mean by :
|
Can you define me what request do you send for having Server Events? Is it a GET or a POST? |
I don't know so much about Server Sent Event.
I don't know what the library do under the hood, if you interested you can maybe find it reading some stuff on the internet or playing with wireshark or your browser debug tools. |
See my more detailed answer at https://stackoverflow.com/a/62404442/5088764 ... |
I think we can close this issue now. |
Hello, I am implementing an http-client for controlling a Leshan server.
I am now trying to implement the observe functionality and I would like to know more on how you handled the multiple responses from the leshan server.
Which is the technique you used?
Cheers
The text was updated successfully, but these errors were encountered: