Start United States USA — software Amateur Radio Homebrew (Part 3) : Preventing Duplicate Tweets Amateur Radio Homebrew...

Amateur Radio Homebrew (Part 3) : Preventing Duplicate Tweets Amateur Radio Homebrew (Part 3) : Preventing Duplicate Tweets

97
0
TEILEN

When patching Twitter into a project, code out some logic preventing duplicate tweets so you don’t hit rate limits. This guide uses MongoDB and Node.js to help.
In my last post (part 2, also see part 1 here) , I talked about Twitter’s API rate limits. Since many Packet Radio transmissions are duplicates by their nature, for example, beacon packets and ID packets, it’s important to have some kind of mechanism to prevent sending these through to Twitter.
The approach I used was to insert each received packet into a MongoDB database, storing the received packet data, who the packet was from and who to, and additional metadata about the packet, for example, when last sent, and when it was last received.
Here’s an example of what each document stored looks like:
My current logic to check for duplicates and record when a tweet is last sent is:
The approach is not yet completely foolproof, but it is stopping the majority of duplicate Tweets sent to Twitter so far.
For the full source check the project on GitHub here .

Continue reading...