Titan Network

More Titan Projects => City Info Tracker => Suggestions and Discussion => Topic started by: Keen on February 09, 2011, 11:05:40 AM

Title: Data feed suggestions
Post by: Keen on February 09, 2011, 11:05:40 AM
Hello all,

I've been using Sentinel this month and liking it so far, mostly because it's lightweight and do not impact my game experience (unlike HeroStats).

One of the features I like most is the character feed. I have a personal blog where I have a Javascript snippet with my character data, updating it manually after every game session. I figured I could use CIT's feed for this, but there are a few things that keep me from it:


For the first item, I suggest a way to convert the JSON feed into a script, not just raw data. Also, it could be a different option, because the raw JSON feed is still useful. Maybe call it "Javascript feed" or something. Currently, the raw "JSON feed" is like this:

Code: [Select]
[{"char_id":"123","name":"Keen Stronghold","status":"Offline",...}, {...}, ..., {...}]
The new "Javascript feed" could be something like this:

Code: [Select]
var CIT_DATA = [{"char_id":"123","name":"Keen Stronghold","status":"Offline",...}, {...}, ..., {...}];
The difference would be that the data is stored inside a variable, which makes the variable available in your page when you do the following:

Code: [Select]
<script type="text/javascript" src="http://cit.cohtitan.com/js/priv/123abc"/>
If you do the above with the current JSON feed, the data isn't stored anywhere and you can't use it.

The character sorting feature is very useful to me. I have several level 50's and there's no way to sort them "the way I want" using the character variables. Having it applied on the feed as well would save me the trouble of creating client-side scripts for sorting.

Last but not least, complete Alignment tracking, which I believe is already in the works. Hopefully.

That's about it. Thanks for listening and keep up the good work :)
Title: Re: Data feed suggestions
Post by: Aggelakis on February 09, 2011, 11:31:27 AM
[other stuff]
I have no idea!

Quote
Last but not least, complete Alignment tracking, which I believe is already in the works. Hopefully.
I do know this one: Yes, the Titan team is hard at work overhauling CIT to be updated for GR/I19.
Title: Re: Data feed suggestions
Post by: Diellan on February 09, 2011, 11:42:15 AM
For the first item, I suggest a way to convert the JSON feed into a script, not just raw data. Also, it could be a different option, because the raw JSON feed is still useful. Maybe call it "Javascript feed" or something. Currently, the raw "JSON feed" is like this:

Code: [Select]
[{"char_id":"123","name":"Keen Stronghold","status":"Offline",...}, {...}, ..., {...}]
The new "Javascript feed" could be something like this:

Code: [Select]
var CIT_DATA = [{"char_id":"123","name":"Keen Stronghold","status":"Offline",...}, {...}, ..., {...}];

Actually, the correct way to do this would be via JSONP (http://en.wikipedia.org/wiki/JSON#JSONP), not via a variable. So you'd make the call as http://cit.cohtitan.com/js/priv/123abc?callback=functionName and you'd receive the a response of
Code: [Select]
functionName({"char_id":"123","name":"Keen Stronghold","status":"Offline",...}, {...}, ..., {...});
Title: Re: Data feed suggestions
Post by: Keen on February 09, 2011, 12:14:20 PM
Actually, the correct way to do this would be via JSONP (http://en.wikipedia.org/wiki/JSON#JSONP), not via a variable. So you'd make the call as http://cit.cohtitan.com/js/priv/123abc?callback=functionName and you'd receive the a response of
Code: [Select]
functionName({"char_id":"123","name":"Keen Stronghold","status":"Offline",...}, {...}, ..., {...});

That's certainly a much cleaner solution. :)

But it's currently unsupported by the JSON feed, right? I tested it with a working feed and the output didn't change.
Title: Re: Data feed suggestions
Post by: Sekoia on February 09, 2011, 02:42:47 PM
JSONP is currently unsupported, but I'll add it to the list of things to look into. CIT has lots of work pending so I can't say when we'll get to it.
Title: Re: Data feed suggestions
Post by: Sekoia on February 15, 2011, 11:44:12 PM
Turned out JSONP was pretty easy to implement. The method for calling it is slightly different than described above, though. Instead of http://cit.cohtitan.com/json/priv/123abc?callback=functionName, use http://cit.cohtitan.com/json/priv/123abc/functionName. There's info on the feed pages about it.
Title: Re: Data feed suggestions
Post by: Keen on February 16, 2011, 12:28:36 AM
Awesome, thanks!!
Title: Re: Data feed suggestions
Post by: Keen on May 12, 2011, 07:59:57 PM
So, if anyone has been following this (other than me), all requests asked by the OP (which happens to be me) made it live with today's patch (made by me) to CIT:


Thanks!

No problem!

 ;D
Title: Re: Data feed suggestions
Post by: GuyPerfect on May 12, 2011, 08:18:49 PM
Thanks!

No problem!

 ;D

Keep doing awesome work and we'll keep letting you talk to yourself. (-:
Title: Re: Data feed suggestions
Post by: DeProgrammer on May 12, 2011, 08:28:44 PM
You posted Waterworks, too! ... sooo I posted the news post. Only four weeks after I decided it was time to release it. :P