Skip to content
TORNLIFE More

[Request] Websocket

Started by Big420 [2584787] on in API Development.

3 replies · 221 views · thread synced · 5 days ago · View on torn.com
About this thread

Posts archived: 4 / 4 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
4
Discussion span
→
People posting
3
Likes on archived posts
6
Posts by staff, officers and moderators
1
Authority score
71 / 100
Historical score
18 / 100
Story score
30 / 100
Engagement score
50 / 100

Most-liked replies

Big420 [2584787]
Why don't the dev's change the API system to Websockets, polling stale data is so 90's...

This (ok I admit this is a big change) would free up a ton of resources on the torn side and that is something that would benefit us all.

Like for example the attack endpoint, we keep polling a 100 item array to see if anything changes, with websockets it would dramatically reduce calls to the servers and database query's.

If the WS middelware is added to the DB middleware you would cut out API DB query's.

On the bot makers side we would authenticate via API key and subscribe to certain channels we want, when the backend does a DB update it would send out a message to the channel linked to that.

It's a system that would greatly benefit the Torn servers, but also make bot's event driven and not history driven.


Really stale stuff like the Torn endpoints could just be send on "welcome" when subscribed to the WS channel.
If missed events on a bot side problem would be an issue the "welcome" message for dynamic channels could also send X past results.

Hope dev's read this and give it a thought, because I can imagine the extra resources freed by such a change would come in handy during Torn events ;)
DeKleineKobini [2114440] Committee Committee
I'm pretty sure there were talks about including websockets in the API, but I'm not sure were we currently stand on that.

I also think that completely replacing it isn't a great idea, being able to get a history is useful at certain times after all.
Big420 [2584787]
Yeah maybe not replacing completely, but if you just use it for occasional historic data (even though that could also be done with WS) it would still mean a huge shift in resources.
Helcostr [1934501] Wiki Editor
we can still send api requests through the websocket, since it's an open channel. so if we wanted to poll history, we still can do it.