6 years, 11 months ago.

What is the magical config settings for using cookbook/IOT?

I'm trying to implement the websocket demonstration at home with the former IoT demonstration here: https://developer.mbed.org/cookbook/IOT

Since the website for Websocket was removed, I installed a local server in my home. I'm using Apache for serving websockets

Here is the IoT.conf that I put in /etc/apache2/sites-available (I executed a2ensite after): <VirtualHost *:8888> ServerAdmin webmaster@localhost DocumentRoot /var/www/html/website ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>

I added Listen 8888 in /etc/apache2/ports.conf

Files for the websocket server are in /var/www/html/website

In /var/www/html/website/Server.py: once started it listen to port 8888 application = tornado.web.Application([ (r'/ws/(.*)/(.*)', WSHandler), ], settings)

In /var/www/html/website/Smooth.php websocket = new WebSocket('ws:192.168.0.3:8888/ws/sensors/rw');

When opening my server's website (http://my_iot_server/website), it works normally, when no device are connected. When opening my server's phone page (http://my_iot_server/website/Smooth.php), it displays device inactive.

Executing this command wscat -c ws:my_iot_server:8888/ws/sensors/wo gives the result below (sudo or not) error: Error: unexpected server response (301)

I tried making these directories and links /var/www/html/website/ws/sensors/rw and wo /var/www/html/ws/sensors/rw and wo

/var/www/IoT links to /var/www/html/website /var/www/html/IoT also links to /var/www/html/website

I enabled the SSL module in Apache, same problem.

posted by Jacques Pelletier 06 May 2017

I made it work; "I tried making these directories and links /var/www/html/website/ws/sensors/rw and wo /var/www/html/ws/sensors/rw and wo /var/www/IoT links to /var/www/html/website /var/www/html/IoT also links to /var/www/html/website" this was not necessary.

Before everything, the server must be started manually: cd /var/www/html/website python server.py

posted by Jacques Pelletier 21 May 2017
Be the first to answer this question.