I notice, from the HTTP logs, that there are lots of custom clients that repeatedly poll the index page for more-or-less live server stats (in fact, this represents the vast part of HTTP traffic altogether). I don't actively mind this or anything like that (it doesn't put any particular strain on the server), but it seems a slight bit retarded when there are far better ways to monitor the server status, which also give truly live and instantaneous updates, rather than periodically refreshed ones.
First of all, there's http://www.havenandhearth.com/mt/srv-mon (don't follow that link in your browser; it won't do you any good at all as browsers aren't typically very good at handling that kind of traffic), which is a long-polling text stream of server status updates. Just open the URL and continuously read lines with updates which are sent in real-time as they happen.
Second, if you have a few screws loose and really want to parse HTML for whatever reason, you can do the same thing that the index page itself does, namely fetching http://www.havenandhearth.com/portal/index/status. It will not return a page until a server status change actually happens. For somewhat more advanced usage, you can pass it the seq URL parameter (.../status?seq=47, for instance), which will return a page immediately if the sequence number given doesn't match the latest update, and only wait if it does match. The returned page has a corresponding "sequence" attribute on its root element, indicating the latest update sequence number. Either way, there should be no real reason to use this method in preference to the above method.
-
loftar
- Posts: 9096
- Joined: Fri Apr 03, 2009 7:05 am
- Location: Your character database
Auto-updated server stats in clients
"Object-oriented design is the roman numerals of computing." -- Rob Pike
-
APXEOLOG
- Posts: 1300
- Joined: Fri Apr 23, 2010 7:58 am
- Location: Somewhere on Earth
Re: Auto-updated server stats in clients
<3
W10 Meme Plot | W9 Mantis Garden | W8 Core | W7 Ofir | W6 the City of Dis | W5 Vitterstad | W4 A.D. | W3 Mirniy
jorb wrote:All your characters will be deleted, and I will level every village any one of them were ever members of.
-
zebratul
- Posts: 438
- Joined: Sun May 08, 2016 9:15 am
- Location: Moscow
Re: Auto-updated server stats in clients
Couldnt resist opening the link in browser after your words. Browser didnt crash, system didnt BSOD, computer didnt explode.loftar wrote:don't follow that link in your browser; it won't do you any good at all as browsers aren't typically very good at handling that kind of traffic.
Disappointment.
Thanks for your work, however, as always (:
-
shubla
- Posts: 13041
- Joined: Sun Nov 03, 2013 11:26 am
- Location: Finland
Re: Auto-updated server stats in clients
As a defense I say that how should one know these top secret urls like http://www.havenandhearth.com/portal/index/status ?

I'm not sure that I have a strong argument against sketch colors - Jorb, November 2019
http://i.imgur.com/CRrirds.png?1
Join the moderated unofficial discord for the game! https://discord.gg/2TAbGj2
Purus Pasta, The Best Client
-
Ukhata
- Posts: 712
- Joined: Wed Jan 29, 2014 9:20 am
Re: Auto-updated server stats in clients
zebratul wrote:Couldnt resist opening the link in browser after your words. Browser didnt crash, system didnt BSOD, computer didnt explode.loftar wrote:don't follow that link in your browser; it won't do you any good at all as browsers aren't typically very good at handling that kind of traffic.
Disappointment.
Thanks for your work, however, as always (:
best way to make us do something, tell us we shouldnt
first thing i did is open it in a browser
-
loftar
- Posts: 9096
- Joined: Fri Apr 03, 2009 7:05 am
- Location: Your character database
Re: Auto-updated server stats in clients
Well, I wasn't actually accusing anyone to begin with, but since you're asking, you could have seen that if you had looked at how the index page is constructed.shubla wrote:As a defense I say that how should one know these top secret urls like http://www.havenandhearth.com/portal/index/status ?
Sorry, I guess I wasn't clear enough; it was indeed as a precaution against disappointment that I added that note, since many browsers will simply just not display anything at all.zebratul wrote:Disappointment.
"Object-oriented design is the roman numerals of computing." -- Rob Pike
-
Granger
- Posts: 9255
- Joined: Mon Mar 22, 2010 2:00 pm
Re: Auto-updated server stats in clients
Firefox works fine.loftar wrote:since many browsers will simply just not display anything at all.
⁎ Mon Mar 22, 2010 ✝ Thu Jan 23, 2020
-
loftar
- Posts: 9096
- Joined: Fri Apr 03, 2009 7:05 am
- Location: Your character database
Re: Auto-updated server stats in clients
Yes, I noticed actually. I guess it has to do with how different browsers do buffering. Chromium probably doesn't begin to parse input until it has gotten a certain window of data to parse, or something like that.Granger wrote:Firefox works fine.
"Object-oriented design is the roman numerals of computing." -- Rob Pike
-
mvgulik
- Posts: 4102
- Joined: Fri May 21, 2010 2:29 am
Re: Auto-updated server stats in clients
Really advanced would be if it would include some older server status changes (at least: going offline/back online) if given an older sequence number.loftar wrote: ... For somewhat more advanced usage, you can pass it the seq URL parameter (.../status?seq=47, for instance), which will return a page immediately if the sequence number given doesn't match the latest update, and only wait if it does match. The returned page has a corresponding "sequence" attribute on its root element, indicating the latest update sequence number..
Even if its record capability is limited to just one day it would be (somewhat) useful. Although I doubt keeping a record of a week, month or longer would pose any problems.
Ignored(29): "Would you like to know more"