Page 1 of 1

mqtt and Apache and mod_websocket_mosquitto

Posted: Wed Feb 19, 2014 10:46 pm
by Kroonen
Hi,

After thinking about node.js I also want to try apache with mosquito.

I followed the instructions and compiled from willems github site

https://github.com/willem4ever/mod_websocket_mosquitto

Everything compiled ok and I can enable the module.

But how can I check if it works? I don't know how to write a simple html as subscriber to display the messages. I use the matt.html, but gives nothing

http://www.kroonen.eu/mqtt/mosq.html

Any idea where I can check things and to configure in html

regards Richard

Re: mqtt and Apache and mod_websocket_mosquitto

Posted: Wed Feb 19, 2014 10:58 pm
by Kroonen
Hi,

I can connect, but no messages receive and after a short who I get this socket read error, any ideas

root@fitpc2:/var/www/mqtt# mosquitto
1392843363: Warning: Mosquitto should not be run as root/administrator.
1392843363: mosquitto version 0.15 (build date 2012-12-29 18:54:18+0000) starting
1392843363: Opening ipv4 listen socket on port 1883.
1392843363: Opening ipv6 listen socket on port 1883.
1392843368: New connection from 127.0.0.1.
1392843368: New client connected from 127.0.0.1 as mjsws/bJjY2KolxGTwlX.
1392843380: New connection from 127.0.0.1.
1392843380: New client connected from 127.0.0.1 as mosq_pub_4194_fitpc2.
1392843388: Socket read error on client mjsws/bJjY2KolxGTwlX, disconnecting.
1392843393: New connection from 127.0.0.1.
1392843393: New client connected from 127.0.0.1 as mjsws/SclqIi2HtMCEVG.
1392843395: New connection from 127.0.0.1.
1392843395: New client connected from 127.0.0.1 as mjsws/IdZ2UNUtq6aEnO.
1392843406: Socket read error on client mjsws/IdZ2UNUtq6aEnO, disconnecting.

Re: mqtt and Apache and mod_websocket_mosquitto

Posted: Wed Feb 19, 2014 11:08 pm
by Kroonen
It looks like the mosq.html is not fine.

If someone has a small html code how to have a subscribed something so I can use it.

regards Richard

Re: mqtt and Apache and mod_websocket_mosquitto

Posted: Thu Feb 20, 2014 12:04 am
by Digit
Have you checked the Apache logs, any strange messages in there?

Re: mqtt and Apache and mod_websocket_mosquitto

Posted: Thu Feb 20, 2014 11:03 am
by Kroonen
Robert

No errrors in log from apache.

Have youj som html code to test?

regards Richard

Re: mqtt and Apache and mod_websocket_mosquitto

Posted: Thu Feb 20, 2014 1:28 pm
by Bwired
We are not using apache as a webserver, i think Willem is the only one, but not sure.....

Re: mqtt and Apache and mod_websocket_mosquitto

Posted: Thu Feb 20, 2014 8:56 pm
by Digit
Richard,

Even better, a live example: :wink:
http://www.hekkers.net/domotica/Smartmeter.aspx

The interesting part for you starts at line 324 (view source).
This example works with Apache and Willem's module.
If you need more info just let me know.

Re: mqtt and Apache and mod_websocket_mosquitto

Posted: Fri Feb 21, 2014 12:16 pm
by Kroonen
Hi,

Thnx for the code.

I still gets disconnected, the browser session is disconnected with socket error after in exact 60 sec.

So it looks like a timer somewhere?

http://www.kroonen.eu/temp/meter.html

Richard

Re: mqtt and Apache and mod_websocket_mosquitto

Posted: Fri Feb 21, 2014 8:47 pm
by RDNZL
If you use Apache, try this:

Code: Select all

$ sudo a2dismod reqtimeout
$ sudo service apache2 restart
So you can test if it's a Apache wait time out, if this solves it, enable it again an try too play with values, otherwise you make Apache more vulnerable for ddos attacks..

Re: mqtt and Apache and mod_websocket_mosquitto

Posted: Fri Feb 21, 2014 9:22 pm
by Digit
Richard,

I get this, does this mean it's working? :lol: :lol:
lalaknipsel.PNG
lalaknipsel.PNG (7.12 KiB) Viewed 16801 times

Re: mqtt and Apache and mod_websocket_mosquitto

Posted: Fri Feb 21, 2014 9:49 pm
by Kroonen
Ron,

That solves it. thnx

@Robert,

Now te values are now better. Ialalalla :lol: :lol:

regards Richard

Re: mqtt and Apache and mod_websocket_mosquitto

Posted: Wed Feb 26, 2014 9:27 pm
by Kroonen
@robert,

You have also value total power usage. I think it's the normal + low tariff.

How do I did you write it in node.js, within the smartmeter.js that reads de p1 meter

regards Richard