Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Open SS index.html from a different device. #43

Closed
4 of 10 tasks
albanoandrea opened this issue Sep 10, 2020 · 4 comments
Closed
4 of 10 tasks

Open SS index.html from a different device. #43

albanoandrea opened this issue Sep 10, 2020 · 4 comments

Comments

@albanoandrea
Copy link

Briefly summarize your issue:

I've successfully cross compiled the smart screen sdk for an STM32MP1-DK2 board.
Since I still don't have a browser on the target, I would like to use my pc, on the same LAN of the device, as browser to verify the work till now.
There is any way to connect to the SS from another device?

What is the expected behavior?

Open ~/sdk_folder/ss-build/modules/GUI/index.html from a device different than the target running the Smart Screen sample app and interact with the device.

What behavior are you observing?

Provide the steps to reproduce the issue, if applicable:

It should be possible to use also 2 host pc to reproduce the request.

Tell us about your environment:

What version of the AVS Device SDK are you using?

  <x.y.z>

Tell us what hardware you're using:

  • Desktop / Laptop
  • Raspberry Pi
  • Other - tell us more:
    STM32MP1-DK2

But this is hardware independent

Tell us about your OS (Type & version):

  • Linux
  • MacOS
  • Raspbian Stretch
  • Raspbian Jessy
  • Other - tell us more:

Have you tried the same use case with AVS Device SDK SampleApp?

  • The issue is not applicable to the AVS Device SDK SampleApp.
  • The issue is not reproducible on the AVS Device SDK SampleApp.
@alexwala
Copy link

alexwala commented Sep 11, 2020

hi !

if already built simply copy sdk_folder/ss-build/modules/GUI to e.g. PC and change host in main.bundle.js from localhost to <your_device_ip> (alse adapt host in app.tsx) - open index.html in browser

on device side adapt config e.g. SmartScreenSDKConfig.json: set websocketInterface to <your_device_ip>:

  "sampleApp": {
    // The interface which the websocket server will bind to.
    // Note: For security reasons, it is strongly recommended that the loopback interface is used.
    // When using interfaces, other than loopback, additional security measures should be taken to ensure
    // the security and integrity of data between the client and server.
    "websocketInterface":"<your_device_ip>"
    // The port which the websocket server will listen to.
    // Note: The port should be a positive integer in the range [1-65535], It is strongly recommended that
    // a port number > 1023 is used
    //"websocketPort":8933
    // The Certificate Authority file to verify client certificate
    // "websocketCertificateAuthority":"ca.cert"
    // The certificate file the websocket server should use when SSL is enabled
    // "websocketCertificate":"server.chain"
    // The private key file the websocket server should use when SSL is enabled
    // "websocketPrivateKey":"server.key"
    // The cache reuse period when downloading content packages
    // "contentCacheReusePeriodInSeconds": "600",
    // The maximum cache size when caching content packages
    // "contentCacheMaxSize": "50"
  }

tested successfully with raspberry pi (Alexa Screen SDK) and windows pc as Alexa GUI

br, alex

@chemudug-amzn
Copy link
Contributor

chemudug-amzn commented Sep 16, 2020

@albanoandrea While it is possible to use our SDK across multiple hosts, please ensure you are aware of all of the security aspects involved to opening up the websocket interface. The solution @alexwala mentioned above should work, let us know if you have any further issues.

@albanoandrea
Copy link
Author

Hi @alexwala,
sorry for the delay, but first attempt didn't work and I had time to try everything from 0 again only today.
I'm using a Ubuntu machine as device, and a Windows machine as browser.

I've modified /modules/GUI/config/SmartScreenSDKConfig.json and modules/GUI/js/src/app.tsx to have the Ubuntu machine ip configured.

Then, after build, I've tried it on the same Ubuntu machine, but it doesn't work.
Pressing F12 on chrome, this is the error:

WebSocket connection to 'ws://192.168.1.7:8933/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
(anonymous) @ main.bundle.js:147

E WSClient: error
r.logFunction @ main.bundle.js:147
(anonymous) @ main.bundle.js:28
onerror @ main.bundle.js:147
error (async)
(anonymous) @ main.bundle.js:147
setTimeout (async)
scheduleConnect @ main.bundle.js:147
onclose @ main.bundle.js:147

If I modify main.bundle.js to point to localhost instead of the ip it works again.
The ip is correct and I tryed also with the Windows machine, without success.

To check if the port is reachable I've tried, while the server is running to run the following commnad:

nc -zv 127.0.0.1 8933
Connection to 127.0.0.1 8933 port [tcp/*] succeeded!
nc -zv 192.168.1.7 8933
nc: connect to 192.168.1.7 port 8933 (tcp) failed: Connection refused

And I can see that going through the lan the connection is refused.

Do you have any tip on other configuration that need to be done?

Thanks,
Andrea

@chemudug-amzn
Copy link
Contributor

chemudug-amzn commented Sep 17, 2020

Hi @albanoandrea,

You can try ssh port forwarding, run this on the machine you want to run the gui:

ssh -L 8933:localhost:8933 192.168.1.x -l pi

... and then it should work as if it is local.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants