{"action":"created","issue":{"url":"https://api.github.com/repos/SamsungDForum/SmartViewSDKHelloWorld/issues/4","repository_url":"https://api.github.com/repos/SamsungDForum/SmartViewSDKHelloWorld","labels_url":"https://api.github.com/repos/SamsungDForum/SmartViewSDKHelloWorld/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/SamsungDForum/SmartViewSDKHelloWorld/issues/4/comments","events_url":"https://api.github.com/repos/SamsungDForum/SmartViewSDKHelloWorld/issues/4/events","html_url":"https://github.com/SamsungDForum/SmartViewSDKHelloWorld/issues/4","id":171682123,"number":4,"title":"Discovery service: getting an error because of the protocol mismatch","user":{"login":"azangru","id":6834224,"avatar_url":"https://avatars.githubusercontent.com/u/6834224?v=3","gravatar_id":"","url":"https://api.github.com/users/azangru","html_url":"https://github.com/azangru","followers_url":"https://api.github.com/users/azangru/followers","following_url":"https://api.github.com/users/azangru/following{/other_user}","gists_url":"https://api.github.com/users/azangru/gists{/gist_id}","starred_url":"https://api.github.com/users/azangru/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azangru/subscriptions","organizations_url":"https://api.github.com/users/azangru/orgs","repos_url":"https://api.github.com/users/azangru/repos","events_url":"https://api.github.com/users/azangru/events{/privacy}","received_events_url":"https://api.github.com/users/azangru/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-08-17T15:06:50Z","updated_at":"2016-08-26T09:02:00Z","closed_at":null,"body":"The discovery service at `multiscreen.samsung.com` is working now. Which is great!\r\n\r\nBut I am having a different problem now. I am trying to run SmartView HelloWorld application in the browser on my development machine, and here is what is happening, step by step:\r\n\r\n- I open [index.html](https://github.com/SamsungDForum/SmartViewSDKHelloWorld/blob/master/HelloWorld_js_mobile_tv/dist/mobile/index.html) in the browser;\r\n- the `main.js` script is started and [runs](https://github.com/SamsungDForum/SmartViewSDKHelloWorld/blob/master/HelloWorld_js_mobile_tv/dist/mobile/scripts/main.js#L53) the `search` function of the `msf` library;\r\n- the `search` function creates an `iframe` pointed to Samsung’s discovery service: (https://multiscreen.samsung.com/discoveryservice/v2/discover);\r\n- the discovery service sends a request to https://multiscreen.samsung.com/discoveryservice/v2/devices, and by some magic correctly detects the address of my TV’s local server. It happens to be listening on http://10.18.0.123:8001/api/v2/ ;\r\n- **and here comes the problem**: the discovery service, from inside the iframe, tries to verify that the TV has been found correctly, and sends a request to the detected url.\r\n\r\nAt this point, a request from the discovery service iframe (at https://multiscreen.samsung.com/discoveryservice/v2/discover) is being sent to my TV’s local server (at http://10.18.0.123:8001/api/v2/), which is obviously blocked, because XHR requests can’t be sent from https to http. As a result of this error, the HelloWorld application fails to find the TV.\r\n\r\nIs there a solution for this problem? Could you please help? @monster-mj ?"},"comment":{"url":"https://api.github.com/repos/SamsungDForum/SmartViewSDKHelloWorld/issues/comments/242673012","html_url":"https://github.com/SamsungDForum/SmartViewSDKHelloWorld/issues/4#issuecomment-242673012","issue_url":"https://api.github.com/repos/SamsungDForum/SmartViewSDKHelloWorld/issues/4","id":242673012,"user":{"login":"azangru","id":6834224,"avatar_url":"https://avatars.githubusercontent.com/u/6834224?v=3","gravatar_id":"","url":"https://api.github.com/users/azangru","html_url":"https://github.com/azangru","followers_url":"https://api.github.com/users/azangru/followers","following_url":"https://api.github.com/users/azangru/following{/other_user}","gists_url":"https://api.github.com/users/azangru/gists{/gist_id}","starred_url":"https://api.github.com/users/azangru/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azangru/subscriptions","organizations_url":"https://api.github.com/users/azangru/orgs","repos_url":"https://api.github.com/users/azangru/repos","events_url":"https://api.github.com/users/azangru/events{/privacy}","received_events_url":"https://api.github.com/users/azangru/received_events","type":"User","site_admin":false},"created_at":"2016-08-26T09:02:00Z","updated_at":"2016-08-26T09:02:00Z","body":"Ok, this time the discovery service can detect my TV, so I can update my information with the original problem I was having.\r\n\r\nSo here goes:\r\n\r\n1) TV is not detected in the browser:\r\n\r\n![image](https://cloud.githubusercontent.com/assets/6834224/17999802/9e0511e2-6b83-11e6-8a71-35f95197cbee.png)\r\n\r\n2) The browser page has an iframe referring to the device discovery service:\r\n\r\n![image](https://cloud.githubusercontent.com/assets/6834224/17999837/cc2b575c-6b83-11e6-87e8-65aef4cdd092.png)\r\n\r\n3) The discovery service document inside the iframe can calls another Samsung service to detect my TV. The TV’s IP and the url of its local server are detected correctly (demonstrated on the screenshot below in the console log):\r\n\r\n![image](https://cloud.githubusercontent.com/assets/6834224/17999920/44141bb4-6b84-11e6-84c2-c7ba50fe232c.png)\r\n\r\n4) The script on the discovery service page attempts to check my TV device by sending an XHR request to it:\r\n\r\n![image](https://cloud.githubusercontent.com/assets/6834224/17999976/8227ba14-6b84-11e6-97f0-cd5843a201f2.png)\r\n\r\n5) The request fails, because the discovery service page is running on https, and TV’s local server is on http. Hence the mixed content error:\r\n\r\n![image](https://cloud.githubusercontent.com/assets/6834224/18000014/b3facafe-6b84-11e6-9668-aaa4d0ede890.png)\r\n\r\nBecause of this, the browser/mobile version of the HelloWorld app running in the browser cannot detect the TV version of the app running on the TV."}}
{"actor":{"display_login":"azangru"}}