Welcome to the Cumulus Support forum.

Latest Cumulus MX V4 release 4.4.2 (build 4085) - 12 March 2025

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

If you are posting a new Topic about an error or if you need help PLEASE read this first viewtopic.php?p=164080#p164080

Ajax vs. websockets

Topics about the Beta trials up to Build 3043, the last build by Cumulus's founder Steve Loft. It was by this time way out of Beta but Steve wanted to keep it that way until he made a decision on his and Cumulus's future.

Moderator: mcrossley

Locked
phloks
Posts: 7
Joined: Tue 07 Jun 2016 8:22 am
Weather Station: WH1080
Operating System: Debian 8
Location: Nijmegen

Ajax vs. websockets

Post by phloks »

Hi,

Recently I installed cumulusmx on my rpi2b and everything looks great. To be able to see the site in the office, I proxied the rpi port 8998 on my webserver. The pages all load, but there is no update of data or gauges. Turns out my company does not allow websockets.....
Changed the three js files to enable Ajax instead of websockets, restarted mono, but the outcome is the same. No updates.
Does Ajax still work?

Thanks,
Hans
User avatar
steve
Cumulus Author
Posts: 26672
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: Ajax vs. websockets

Post by steve »

As far as I know it does, yes. Do you have any error messages in the F12 console in your browser?
Steve
phloks
Posts: 7
Joined: Tue 07 Jun 2016 8:22 am
Weather Station: WH1080
Operating System: Debian 8
Location: Nijmegen

Re: Ajax vs. websockets

Post by phloks »

Hi Steve,

Thanks for giving a reaction very fast.

I had to search for it, but yes, indeed there are error msgs in the net log of firefox :

GET XHR http://www.hanslammerts.nl/cumulus/api/data/currentdata [HTTP/1.1 404 Not Found 0ms]

every 2 seconds or so.
If I do a curl -v http://localhost:8998/api/data/currentdata, on the Pi, I do get info back (json ?).
A curl -v https://www.hanslammerts.nl/cumulus/api ... urrentdata gives the 404.

I think there must be something wrong with my proxy or proxyreverse statements in apache2, but I can't
see what it is at the moment.
I can not expose port 8998 to the outside world (well, I could, but I don't want to, and besides, my company
won't let anything else through the firewall than 80 and 443) .

If you have a suggestion on how to fix this, or anyone else for that matter, I would be very grateful.
In the mean time I'll look into the proxy possibilities.

Thanks,
Hans
User avatar
steve
Cumulus Author
Posts: 26672
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: Ajax vs. websockets

Post by steve »

Sorry, it's beyond me. You're mapping port 80 onto port 8998 in some way? And that works for html pages but not for the api call? Hopefully someone who understands these things will be able to help.
Steve
freddie
Posts: 2870
Joined: Wed 08 Jun 2011 11:19 am
Weather Station: Davis Vantage Pro 2 + Ecowitt
Operating System: GNU/Linux Ubuntu 24.04 LXC
Location: Alcaston, Shropshire, UK
Contact:

Re: Ajax vs. websockets

Post by freddie »

steve wrote:Hopefully someone who understands these things will be able to help.
Could you post your reverse proxy configuration, please?
Freddie
Image
phloks
Posts: 7
Joined: Tue 07 Jun 2016 8:22 am
Weather Station: WH1080
Operating System: Debian 8
Location: Nijmegen

Re: Ajax vs. websockets

Post by phloks »

Thanks Steve.
Hi Freddie,

Sure. This is it (probably too simple.....) :
<Location /cumulus>
ProxyPass http://192.168.0.105:8998/
ProxyPassReverse http://192.168.0.105:8998/
</Location>
Thanks,
Hans
freddie
Posts: 2870
Joined: Wed 08 Jun 2011 11:19 am
Weather Station: Davis Vantage Pro 2 + Ecowitt
Operating System: GNU/Linux Ubuntu 24.04 LXC
Location: Alcaston, Shropshire, UK
Contact:

Re: Ajax vs. websockets

Post by freddie »

phloks wrote:Thanks Steve.
Hi Freddie,

Sure. This is it (probably too simple.....) :
<Location /cumulus>
ProxyPass http://192.168.0.105:8998/
ProxyPassReverse http://192.168.0.105:8998/
</Location>
Thanks,
Hans
Looks fine to me. I don't recommend doing what you've done, by the way, as anybody can look at your internet settings and passwords, etc! If you must proxy the dahboard, I would ensure that the settings tab (and any data URLs it calls) is excluded.
Having said that, I've done some browsing of your interface with the F12 console switched on. As you say, calls to api/data/currentdata return 404 (not found) HTTP response. This is also true for a lot of the .json files that contain the data for the pages. Some but not all return 404 (not found). The puzzling thing is that some of the .json files sometimes return okay. So I think your reverse proxy configuration is sound - but something else isn't quite right. It would be a good idea to look in the Apache log files, and also the log files for the Cumulus webserver - if there are any. There may be clues in there.

A better way to access your dashboard would be through an SSH tunnel - assuming your company firewall allows you to make SSH connections to external hosts. Use a client (PuTTY is a good one on Windows) and Google how to create tunnels. That way it is only you who can access your interface externally - which is much safer than letting everybody!!
Freddie
Image
phloks
Posts: 7
Joined: Tue 07 Jun 2016 8:22 am
Weather Station: WH1080
Operating System: Debian 8
Location: Nijmegen

Re: Ajax vs. websockets

Post by phloks »

Hi Freddie,

Thanks for the elaborate answer.
I do realise that what I've done sofar is not quite safe, and I intended to figure out how to disable the settings tab when proxying would have been successful.
Anyhow, I'll try to set debug levels to a higher level where I can, and see if I can detect something.

Thanks for thinking with me !
Oh, and BTW, no, my company does not allow to connect to remote ssh servers........ :x

Thanks,
Hans
User avatar
steve
Cumulus Author
Posts: 26672
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: Ajax vs. websockets

Post by steve »

You could just upload to a web site, and view the data that way. It would be much simpler ;)
Steve
phloks
Posts: 7
Joined: Tue 07 Jun 2016 8:22 am
Weather Station: WH1080
Operating System: Debian 8
Location: Nijmegen

Re: Ajax vs. websockets

Post by phloks »

Hi Steve,

Yeah, I really should do some RTFM.... :bash: :groan:
instead of relying on my numerous attempts (and failures) of installing software on Linux..

My main concern is that I'd like the website to be as realtime as possible. Don't know if that
can be achieved using FTP only.
Then again, I did not read that section of the documentation thoroughly enough, and I also saw a post
of someone who has used rsync successfully.
So, thank you, gentlemen, for the assistance. Will go figure this out a bit more in-depth.

Keep up the good work !

Thanks,
Hans
User avatar
mcrossley
Posts: 14388
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Ajax vs. websockets

Post by mcrossley »

The website *could* be on your rPi, then there would no need to FTP, just copy the files locally. If you want it viewable by the public then a hosted server would be better, especially if you have a dynamic IP address.
Locked