Auto-updated server stats in clients

Forum for alternative clients, mods & discussions on the same.

Auto-updated server stats in clients

Postby loftar » Fri Oct 07, 2016 9:43 pm

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.
"Object-oriented design is the roman numerals of computing." -- Rob Pike
User avatar
loftar
 
Posts: 8926
Joined: Fri Apr 03, 2009 7:05 am

Re: Auto-updated server stats in clients

Postby APXEOLOG » Mon Oct 10, 2016 11:38 am

<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.
User avatar
APXEOLOG
 
Posts: 1267
Joined: Fri Apr 23, 2010 7:58 am
Location: Somewhere on Earth

Re: Auto-updated server stats in clients

Postby zebratul » Mon Oct 10, 2016 2:30 pm

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.


Couldnt resist opening the link in browser after your words. Browser didnt crash, system didnt BSOD, computer didnt explode.
Disappointment.

Thanks for your work, however, as always (:
User avatar
zebratul
 
Posts: 438
Joined: Sun May 08, 2016 9:15 am
Location: Moscow

Re: Auto-updated server stats in clients

Postby shubla » Mon Oct 10, 2016 2:57 pm

As a defense I say that how should one know these top secret urls like http://www.havenandhearth.com/portal/index/status ?
Image
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
User avatar
shubla
 
Posts: 13043
Joined: Sun Nov 03, 2013 11:26 am
Location: Finland

Re: Auto-updated server stats in clients

Postby Ukhata » Mon Oct 10, 2016 3:14 pm

zebratul wrote:
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.


Couldnt resist opening the link in browser after your words. Browser didnt crash, system didnt BSOD, computer didnt explode.
Disappointment.

Thanks for your work, however, as always (:



best way to make us do something, tell us we shouldnt :P
first thing i did is open it in a browser :D
Ukhata
 
Posts: 695
Joined: Wed Jan 29, 2014 9:20 am

Re: Auto-updated server stats in clients

Postby loftar » Mon Oct 10, 2016 6:38 pm

shubla wrote:As a defense I say that how should one know these top secret urls like http://www.havenandhearth.com/portal/index/status ?

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.

zebratul wrote:Disappointment.

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.
"Object-oriented design is the roman numerals of computing." -- Rob Pike
User avatar
loftar
 
Posts: 8926
Joined: Fri Apr 03, 2009 7:05 am

Re: Auto-updated server stats in clients

Postby Granger » Mon Oct 10, 2016 9:06 pm

loftar wrote:since many browsers will simply just not display anything at all.

Firefox works fine.
⁎ Mon Mar 22, 2010 ✝ Thu Jan 23, 2020
User avatar
Granger
 
Posts: 9263
Joined: Mon Mar 22, 2010 2:00 pm

Re: Auto-updated server stats in clients

Postby loftar » Mon Oct 10, 2016 9:08 pm

Granger wrote:Firefox works fine.

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.
"Object-oriented design is the roman numerals of computing." -- Rob Pike
User avatar
loftar
 
Posts: 8926
Joined: Fri Apr 03, 2009 7:05 am


Return to The Wizards' Tower

Who is online

Users browsing this forum: toagoss and 18 guests