Skip to content
TORNLIFE More

server push?

Started by snozzled [1968271] on in API Development.

15 replies · 120 views · thread synced · 5 days ago · View on torn.com
About this thread

Posts archived: 16 / 16 posts (100%) · the total is Torn's reply count + the opening post at the last fetch

Counted by TornLife from the archived posts.

Archived posts
16
Discussion span
→
People posting
8
Likes on archived posts
0
Posts by staff, officers and moderators
2
Authority score
73 / 100
Historical score
30 / 100
Story score
26 / 100
Engagement score
50 / 100
snozzled [1968271]

Is there any way to get server push for events? AFAICT even CityWatch uses polling, though at least it seems to have stateful server support so it can get only the diffs since last poll. Even exposing that to the general API would be a step in the right direction.
Meme_Raven [1891116]

Nope, it would probably require a "special" server software. Best you can do is set your application to download new data every x seconds and compare new to old data.
LouBaker [1162207]

Does City Watch read all the stuff we are reading,
or does read one location on the server which stores a event ID
the ID is the event type and then City Watch reads and Displays the Event.
McNeo [864688]

CW came out a while ago so I imagine it gets it's info some other way. Though, I'm sure CW will become very heavily duplicated as newer developers test out the API.
snozzled [1968271]

City Watch has its own endpoints on the server, but still relies on the client polling it. For the mobile era that's not a clean model, since it requires an intermediary to do the polling and convert to push notifications. This game really hasn't aged well. Every timer based game in the last few years natively pings your phone/tablet when stuff happens, it's an important tool for driving player engagement. Don't duplicate CW. Leapfrog it and build something better.
snozzled [1968271]

hmm, the intermediate developer would lose the advantages in that they still need to poll the server, but the end user of the mobile device would be better off, in that their tablet/phone would receive push notifications rather than having to poll, thus improving power efficiency and reducing network data costs. Not entirely sure the torn servers are ready for something that polls the api at high frequency on behalf of potentially thousands of users, but they seem to be sending us down that route rather than putting in server side push, so: game on.
snozzled [1968271]

So, here is a question: If you could have notifications pushed to your phone, what things would you wish to be notified of? I'm thinking: energy/nerve reaches full ; new message ; new event. Anything else?
Mauk [1494436]

Life drops; arrived at destination; booster/medical/drugs cooldowns; stock reached certain value; new torn day; and so on... There are too many options!
snozzled [1968271]

ok, got something basic working. yay for pushbullet, saves throwing together a client app. Really can't be bothered running it as a public service though. Perhaps someone who already has a polling server with user account management will step up. icey?
IceBlueFire [776] Officer Officer

I've been trying to come up with a way to push notifications without asking for phone numbers and without costing me money for a texting service of some kind. I'm open to ideas though.
snozzled [1968271]

pushbullet via oauth api. user installs free app from pushbullet, logs in to your site with oauth to allow you to grab credentials which you then use with the pushbullet api to send stuff that pushbullet then routes to their device(s). or you can roll your own equivalent with google cloud messaging, but then you have to code up the android app too, which is a pain.
aurel1 [1046304] Admin Staff

Just to note: server service for long polling is a good thing of course, but current version of api is more like a thing to gather useful statistics, it's not a very best choice for live updates (however, it can be used for that). Perhaps we will think to allow something through long poll requests, so it can be events driven.

And for now, yes - you can use a server that will gather info using api and will provide a polling service.
MrHat [210720]

I thought this was a great opportunity to try out the Reactive Extensions .NET library, so far I've built a live stream of faction attacks using signalr in asp.net. I hope to create some kind of chaining assistant, but I have no concrete plans yet.

The system polls the faction API every X seconds, where X can vary based on necessity. Once in private beta I plan to pool the API keys of faction members to increase the polling rate without running into 100 req's/min limit. That way you can approach real-time data streams.

This method is of course only useful for shared information like faction attack logs. Private info like energy and nerve wouldn't benefit from key pooling.