Skip to content
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

HTTP message does not always include topic #558

Closed
balloob opened this issue Dec 8, 2018 · 14 comments
Closed

HTTP message does not always include topic #558

balloob opened this issue Dec 8, 2018 · 14 comments
Assignees
Labels

Comments

@balloob
Copy link

balloob commented Dec 8, 2018

Release notes for 9.5.7 states:

  • [NEW] topic in HTTP json payload

With Home Assistant we're relying on this value and somehow we noticed that this topic is not always available. For some people it is, for some people not. Some people think it's related to setting tracker ID but we're still investigating.

I tried to look in the code but my objective-c is not good enough to figure it out where the dictionary is being created.

@balloob
Copy link
Author

balloob commented Dec 8, 2018

So topic in HTTP json payload was introduced in commits:

One thing I was thinking it might be, and this is just a hunch, that there are messages queued for delivery before the HTTP endpoint is configured, and that pressing the report button sends the old messages that do not contain the topic key.

@ckrey
Copy link
Member

ckrey commented Dec 12, 2018

If the queued messages are not acknowledged by HTTP 200, then they will not be deleted from the fifo queue. To clear the queue re-install the app or change your connection settings back and forth

@balloob
Copy link
Author

balloob commented Dec 12, 2018

So am I interpreting it correctly that some old messages without topic might end up in the queue before a user configures the HTTP endpoint?

I did change it now to discard them by returning 200 but I wonder if we should ever deliver messages without topic to the HTTP endpoint.

@ckrey
Copy link
Member

ckrey commented Dec 12, 2018

I don't know what caused the backend to return a non-200 response.
Do you have a log of the messages that caused the problem?

The only example I see is the case when you decide to encrypt the data by the owntracks application:
{'_type': 'encrypted', 'data': '<redacted>'} which is the desired output.

@ckrey ckrey self-assigned this Dec 12, 2018
@ckrey ckrey added the question label Dec 12, 2018
@balloob
Copy link
Author

balloob commented Dec 12, 2018

Well the Home Assistant server returned a 400 because it was expecting a topic in the message. This has been fixed now and we return a 200 to discard it (source).

Interesting note about the encryption. I did not think about that. With Android we always get the user and device as headers (if they are configured). I guess we might not handle encrypted iOS payloads correctly, going to test that and will report back.

@jpmens
Copy link
Member

jpmens commented Dec 12, 2018

@balloob please be aware that our Android app also has optional encryption just like on iOS.

@binarybucks
Copy link

binarybucks commented Dec 12, 2018

In Android you can also just pass the username and device as URL parameters ;)
They're just send as headers if you explicitly specify them in interface.

@balloob
Copy link
Author

balloob commented Dec 12, 2018

Alright, did some testing:

  • Android, no encryption: request includes X-Limit-U and X-Limit-D headers to recreate topic
  • Android, encryption: request includes X-Limit-U and X-Limit-D headers to recreate topic

Still working on getting someone to test the iOS payloads to see if it's the encrypted message that breaks it.

@balloob
Copy link
Author

balloob commented Dec 12, 2018

  • iOS, no encryption: contains topic
  • iOS, encryption: does not contain topic. Decrypted payload does.

Okay, case solved, thanks all !

@balloob balloob closed this as completed Dec 12, 2018
@jpmens
Copy link
Member

jpmens commented Dec 12, 2018

@balloob if you feel very brave, would you like to provide a small PR for our Booklet?

https://github.com/owntracks/booklet/tree/master/docs

@balloob
Copy link
Author

balloob commented Dec 12, 2018

Sure! owntracks/booklet#37

@jpmens
Copy link
Member

jpmens commented Dec 12, 2018

Thank you very much!

@jpmens
Copy link
Member

jpmens commented Dec 14, 2018

We've just discussed this, and we will implement the headers in iOS as well. Reopening.

@ckrey
Copy link
Member

ckrey commented Dec 16, 2018

Implementation tracked in #560

@ckrey ckrey closed this as completed Dec 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants