{"action":"created","comment":{"url":"https://api.github.com/repos/traccar/traccar/pulls/comments/232603975","pull_request_review_id":173834878,"id":232603975,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMjYwMzk3NQ==","diff_hunk":"@@ -46,12 +49,53 @@ protected Object decode(\n         JsonObject root = Json.createReader(\n                 new StringReader(request.content().toString(StandardCharsets.US_ASCII))).readObject();\n \n-        if (!root.containsKey(\"_type\") || !root.getString(\"_type\").equals(\"location\")) {\n+        if (!root.containsKey(\"_type\")) {\n+            sendResponse(channel, HttpResponseStatus.OK);\n+            return null;\n+        }\n+        if (!root.getString(\"_type\").equals(\"location\")\n+            && !root.getString(\"_type\").equals(\"lwt\")) {\n+            sendResponse(channel, HttpResponseStatus.BAD_REQUEST);\n+            return null;\n+        }\n+\n+        Position position = new Position();\n+        String uniqueId;\n+\n+        if (root.containsKey(\"topic\")) {\n+            uniqueId = root.getString(\"topic\");\n+            if (root.containsKey(\"tid\")) {\n+                position.set(\"tid\", root.getString(\"tid\"));\n+            }\n+        } else {\n+            uniqueId = root.getString(\"tid\");\n+        }\n+        DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, uniqueId);\n+        if (deviceSession == null) {\n+            sendResponse(channel, HttpResponseStatus.BAD_REQUEST);\n+            return null;\n+        }\n+\n+        if (root.getString(\"_type\").equals(\"lwt\")) {\n+            Context.getConnectionManager().updateDevice(deviceSession.getDeviceId(), Device.STATUS_OFFLINE, new Date());","path":"src/org/traccar/protocol/OwnTracksProtocolDecoder.java","position":55,"original_position":63,"commit_id":"e8f0c569e2aec2ad44a532a8bc366556e1f374c5","original_commit_id":"22fd6a6a2a38de73b0ce053c862bd7221e9c2184","user":{"login":"ckrey","id":4027289,"node_id":"MDQ6VXNlcjQwMjcyODk=","avatar_url":"https://avatars3.githubusercontent.com/u/4027289?v=4","gravatar_id":"","url":"https://api.github.com/users/ckrey","html_url":"https://github.com/ckrey","followers_url":"https://api.github.com/users/ckrey/followers","following_url":"https://api.github.com/users/ckrey/following{/other_user}","gists_url":"https://api.github.com/users/ckrey/gists{/gist_id}","starred_url":"https://api.github.com/users/ckrey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ckrey/subscriptions","organizations_url":"https://api.github.com/users/ckrey/orgs","repos_url":"https://api.github.com/users/ckrey/repos","events_url":"https://api.github.com/users/ckrey/events{/privacy}","received_events_url":"https://api.github.com/users/ckrey/received_events","type":"User","site_admin":false},"body":"What would be the right way to indicate a Device gone off-line when using HTTP?","created_at":"2018-11-12T10:29:50Z","updated_at":"2018-11-12T10:29:50Z","html_url":"https://github.com/traccar/traccar/pull/4141#discussion_r232603975","pull_request_url":"https://api.github.com/repos/traccar/traccar/pulls/4141","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/traccar/traccar/pulls/comments/232603975"},"html":{"href":"https://github.com/traccar/traccar/pull/4141#discussion_r232603975"},"pull_request":{"href":"https://api.github.com/repos/traccar/traccar/pulls/4141"}},"in_reply_to_id":232594867},"pull_request":{"url":"https://api.github.com/repos/traccar/traccar/pulls/4141","id":230074404,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMwMDc0NDA0","html_url":"https://github.com/traccar/traccar/pull/4141","diff_url":"https://github.com/traccar/traccar/pull/4141.diff","patch_url":"https://github.com/traccar/traccar/pull/4141.patch","issue_url":"https://api.github.com/repos/traccar/traccar/issues/4141","number":4141,"state":"open","locked":false,"title":"Owntracks Protocol for Traccar 4.2","user":{"login":"ckrey","id":4027289,"node_id":"MDQ6VXNlcjQwMjcyODk=","avatar_url":"https://avatars3.githubusercontent.com/u/4027289?v=4","gravatar_id":"","url":"https://api.github.com/users/ckrey","html_url":"https://github.com/ckrey","followers_url":"https://api.github.com/users/ckrey/followers","following_url":"https://api.github.com/users/ckrey/following{/other_user}","gists_url":"https://api.github.com/users/ckrey/gists{/gist_id}","starred_url":"https://api.github.com/users/ckrey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ckrey/subscriptions","organizations_url":"https://api.github.com/users/ckrey/orgs","repos_url":"https://api.github.com/users/ckrey/repos","events_url":"https://api.github.com/users/ckrey/events{/privacy}","received_events_url":"https://api.github.com/users/ckrey/received_events","type":"User","site_admin":false},"body":"- Stricter content checks\r\n- Event creation\r\n- Device status handling\r\n- Additional attributes\r\n\r\nsee [message description](http://owntracks.org/booklet/tech/json/#_typelocation)\r\n","created_at":"2018-11-12T09:53:29Z","updated_at":"2018-11-12T10:29:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0790c90d9d8e0a92e82528c140a5996ff129bb4a","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/traccar/traccar/pulls/4141/commits","review_comments_url":"https://api.github.com/repos/traccar/traccar/pulls/4141/comments","review_comment_url":"https://api.github.com/repos/traccar/traccar/pulls/comments{/number}","comments_url":"https://api.github.com/repos/traccar/traccar/issues/4141/comments","statuses_url":"https://api.github.com/repos/traccar/traccar/statuses/e8f0c569e2aec2ad44a532a8bc366556e1f374c5","head":{"label":"ckrey:owntracks42","ref":"owntracks42","sha":"e8f0c569e2aec2ad44a532a8bc366556e1f374c5","user":{"login":"ckrey","id":4027289,"node_id":"MDQ6VXNlcjQwMjcyODk=","avatar_url":"https://avatars3.githubusercontent.com/u/4027289?v=4","gravatar_id":"","url":"https://api.github.com/users/ckrey","html_url":"https://github.com/ckrey","followers_url":"https://api.github.com/users/ckrey/followers","following_url":"https://api.github.com/users/ckrey/following{/other_user}","gists_url":"https://api.github.com/users/ckrey/gists{/gist_id}","starred_url":"https://api.github.com/users/ckrey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ckrey/subscriptions","organizations_url":"https://api.github.com/users/ckrey/orgs","repos_url":"https://api.github.com/users/ckrey/repos","events_url":"https://api.github.com/users/ckrey/events{/privacy}","received_events_url":"https://api.github.com/users/ckrey/received_events","type":"User","site_admin":false},"repo":{"id":114383676,"node_id":"MDEwOlJlcG9zaXRvcnkxMTQzODM2NzY=","name":"traccar","full_name":"ckrey/traccar","private":false,"owner":{"login":"ckrey","id":4027289,"node_id":"MDQ6VXNlcjQwMjcyODk=","avatar_url":"https://avatars3.githubusercontent.com/u/4027289?v=4","gravatar_id":"","url":"https://api.github.com/users/ckrey","html_url":"https://github.com/ckrey","followers_url":"https://api.github.com/users/ckrey/followers","following_url":"https://api.github.com/users/ckrey/following{/other_user}","gists_url":"https://api.github.com/users/ckrey/gists{/gist_id}","starred_url":"https://api.github.com/users/ckrey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ckrey/subscriptions","organizations_url":"https://api.github.com/users/ckrey/orgs","repos_url":"https://api.github.com/users/ckrey/repos","events_url":"https://api.github.com/users/ckrey/events{/privacy}","received_events_url":"https://api.github.com/users/ckrey/received_events","type":"User","site_admin":false},"html_url":"https://github.com/ckrey/traccar","description":"Traccar GPS Tracking System","fork":true,"url":"https://api.github.com/repos/ckrey/traccar","forks_url":"https://api.github.com/repos/ckrey/traccar/forks","keys_url":"https://api.github.com/repos/ckrey/traccar/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ckrey/traccar/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ckrey/traccar/teams","hooks_url":"https://api.github.com/repos/ckrey/traccar/hooks","issue_events_url":"https://api.github.com/repos/ckrey/traccar/issues/events{/number}","events_url":"https://api.github.com/repos/ckrey/traccar/events","assignees_url":"https://api.github.com/repos/ckrey/traccar/assignees{/user}","branches_url":"https://api.github.com/repos/ckrey/traccar/branches{/branch}","tags_url":"https://api.github.com/repos/ckrey/traccar/tags","blobs_url":"https://api.github.com/repos/ckrey/traccar/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ckrey/traccar/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ckrey/traccar/git/refs{/sha}","trees_url":"https://api.github.com/repos/ckrey/traccar/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ckrey/traccar/statuses/{sha}","languages_url":"https://api.github.com/repos/ckrey/traccar/languages","stargazers_url":"https://api.github.com/repos/ckrey/traccar/stargazers","contributors_url":"https://api.github.com/repos/ckrey/traccar/contributors","subscribers_url":"https://api.github.com/repos/ckrey/traccar/subscribers","subscription_url":"https://api.github.com/repos/ckrey/traccar/subscription","commits_url":"https://api.github.com/repos/ckrey/traccar/commits{/sha}","git_commits_url":"https://api.github.com/repos/ckrey/traccar/git/commits{/sha}","comments_url":"https://api.github.com/repos/ckrey/traccar/comments{/number}","issue_comment_url":"https://api.github.com/repos/ckrey/traccar/issues/comments{/number}","contents_url":"https://api.github.com/repos/ckrey/traccar/contents/{+path}","compare_url":"https://api.github.com/repos/ckrey/traccar/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ckrey/traccar/merges","archive_url":"https://api.github.com/repos/ckrey/traccar/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ckrey/traccar/downloads","issues_url":"https://api.github.com/repos/ckrey/traccar/issues{/number}","pulls_url":"https://api.github.com/repos/ckrey/traccar/pulls{/number}","milestones_url":"https://api.github.com/repos/ckrey/traccar/milestones{/number}","notifications_url":"https://api.github.com/repos/ckrey/traccar/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ckrey/traccar/labels{/name}","releases_url":"https://api.github.com/repos/ckrey/traccar/releases{/id}","deployments_url":"https://api.github.com/repos/ckrey/traccar/deployments","created_at":"2017-12-15T15:18:06Z","updated_at":"2018-11-12T08:13:11Z","pushed_at":"2018-11-12T10:23:22Z","git_url":"git://github.com/ckrey/traccar.git","ssh_url":"git@github.com:ckrey/traccar.git","clone_url":"https://github.com/ckrey/traccar.git","svn_url":"https://github.com/ckrey/traccar","homepage":"https://www.traccar.org","size":13831,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"traccar:master","ref":"master","sha":"3ea901e4198c6dbbdde74c6e49805714694c8271","user":{"login":"traccar","id":37892282,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM3ODkyMjgy","avatar_url":"https://avatars1.githubusercontent.com/u/37892282?v=4","gravatar_id":"","url":"https://api.github.com/users/traccar","html_url":"https://github.com/traccar","followers_url":"https://api.github.com/users/traccar/followers","following_url":"https://api.github.com/users/traccar/following{/other_user}","gists_url":"https://api.github.com/users/traccar/gists{/gist_id}","starred_url":"https://api.github.com/users/traccar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/traccar/subscriptions","organizations_url":"https://api.github.com/users/traccar/orgs","repos_url":"https://api.github.com/users/traccar/repos","events_url":"https://api.github.com/users/traccar/events{/privacy}","received_events_url":"https://api.github.com/users/traccar/received_events","type":"Organization","site_admin":false},"repo":{"id":4038949,"node_id":"MDEwOlJlcG9zaXRvcnk0MDM4OTQ5","name":"traccar","full_name":"traccar/traccar","private":false,"owner":{"login":"traccar","id":37892282,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM3ODkyMjgy","avatar_url":"https://avatars1.githubusercontent.com/u/37892282?v=4","gravatar_id":"","url":"https://api.github.com/users/traccar","html_url":"https://github.com/traccar","followers_url":"https://api.github.com/users/traccar/followers","following_url":"https://api.github.com/users/traccar/following{/other_user}","gists_url":"https://api.github.com/users/traccar/gists{/gist_id}","starred_url":"https://api.github.com/users/traccar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/traccar/subscriptions","organizations_url":"https://api.github.com/users/traccar/orgs","repos_url":"https://api.github.com/users/traccar/repos","events_url":"https://api.github.com/users/traccar/events{/privacy}","received_events_url":"https://api.github.com/users/traccar/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/traccar/traccar","description":"Traccar GPS Tracking System","fork":false,"url":"https://api.github.com/repos/traccar/traccar","forks_url":"https://api.github.com/repos/traccar/traccar/forks","keys_url":"https://api.github.com/repos/traccar/traccar/keys{/key_id}","collaborators_url":"https://api.github.com/repos/traccar/traccar/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/traccar/traccar/teams","hooks_url":"https://api.github.com/repos/traccar/traccar/hooks","issue_events_url":"https://api.github.com/repos/traccar/traccar/issues/events{/number}","events_url":"https://api.github.com/repos/traccar/traccar/events","assignees_url":"https://api.github.com/repos/traccar/traccar/assignees{/user}","branches_url":"https://api.github.com/repos/traccar/traccar/branches{/branch}","tags_url":"https://api.github.com/repos/traccar/traccar/tags","blobs_url":"https://api.github.com/repos/traccar/traccar/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/traccar/traccar/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/traccar/traccar/git/refs{/sha}","trees_url":"https://api.github.com/repos/traccar/traccar/git/trees{/sha}","statuses_url":"https://api.github.com/repos/traccar/traccar/statuses/{sha}","languages_url":"https://api.github.com/repos/traccar/traccar/languages","stargazers_url":"https://api.github.com/repos/traccar/traccar/stargazers","contributors_url":"https://api.github.com/repos/traccar/traccar/contributors","subscribers_url":"https://api.github.com/repos/traccar/traccar/subscribers","subscription_url":"https://api.github.com/repos/traccar/traccar/subscription","commits_url":"https://api.github.com/repos/traccar/traccar/commits{/sha}","git_commits_url":"https://api.github.com/repos/traccar/traccar/git/commits{/sha}","comments_url":"https://api.github.com/repos/traccar/traccar/comments{/number}","issue_comment_url":"https://api.github.com/repos/traccar/traccar/issues/comments{/number}","contents_url":"https://api.github.com/repos/traccar/traccar/contents/{+path}","compare_url":"https://api.github.com/repos/traccar/traccar/compare/{base}...{head}","merges_url":"https://api.github.com/repos/traccar/traccar/merges","archive_url":"https://api.github.com/repos/traccar/traccar/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/traccar/traccar/downloads","issues_url":"https://api.github.com/repos/traccar/traccar/issues{/number}","pulls_url":"https://api.github.com/repos/traccar/traccar/pulls{/number}","milestones_url":"https://api.github.com/repos/traccar/traccar/milestones{/number}","notifications_url":"https://api.github.com/repos/traccar/traccar/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/traccar/traccar/labels{/name}","releases_url":"https://api.github.com/repos/traccar/traccar/releases{/id}","deployments_url":"https://api.github.com/repos/traccar/traccar/deployments","created_at":"2012-04-16T08:33:49Z","updated_at":"2018-11-12T08:25:13Z","pushed_at":"2018-11-12T10:23:23Z","git_url":"git://github.com/traccar/traccar.git","ssh_url":"git@github.com:traccar/traccar.git","clone_url":"https://github.com/traccar/traccar.git","svn_url":"https://github.com/traccar/traccar","homepage":"https://www.traccar.org","size":13815,"stargazers_count":1522,"watchers_count":1522,"language":"Java","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1159,"mirror_url":null,"archived":false,"open_issues_count":1195,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":1159,"open_issues":1195,"watchers":1522,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/traccar/traccar/pulls/4141"},"html":{"href":"https://github.com/traccar/traccar/pull/4141"},"issue":{"href":"https://api.github.com/repos/traccar/traccar/issues/4141"},"comments":{"href":"https://api.github.com/repos/traccar/traccar/issues/4141/comments"},"review_comments":{"href":"https://api.github.com/repos/traccar/traccar/pulls/4141/comments"},"review_comment":{"href":"https://api.github.com/repos/traccar/traccar/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/traccar/traccar/pulls/4141/commits"},"statuses":{"href":"https://api.github.com/repos/traccar/traccar/statuses/e8f0c569e2aec2ad44a532a8bc366556e1f374c5"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"ckrey"}}