This is a complex topic, and I’m not sure if it fits here or in another category. I’m looking for best practices but the impact will be felt most on the iOS end, so I felt this is a good place to start.
I am writing a running relay manager app.
There are teams who commit to pace for different legs.
The entire “plan” is updated based on all the remote input from the team.
Then on race day, they each check into each milestone, and could update their paces anytime along the way.
I’ve gone back and forward on how to manage the server end and since a 36 leg relay is a 5k JSON file, and It’s all still undergoing rapid changes on in the design, I’ve opted to do a file based synchronization, not database, although I’ll likely move it to a database later.
Current workflow:
When someone changes something in a leg, they sent the changes to the server.
If the team has never logged a change, the server opens up the template (JSON file) and inserts the changed portion and saves it out to the team’s folder.
If the team has logged a change, the server opens the team’s latest file, inserts the changes and saves it out.
Each leg has a version tracking how many iterations have occurred.
Once the current, updated plan, has been saved, the server responds with an OK and the client (iOS device) requests an update so that they have their change and any others that may have occurred along the way.
My Challenge:
I want to make the updates invisible to the end-user. What I mean by this is that when they update something like changing their pace from 7:40 to 7:55, I don’t want them to have to do anything to push the changes. It’s easy enough to send an update whenever they change anything, but is every keystroke change too frequent?
I’m on the fence about this, because the sample relay I’m working with is 200 miles with 36 legs (probably the most complex case I’ll ever encounter) and with a 5KB JSON file, maybe I can just be perpetually serving that back and forward without concern.
Part 2.
for the users who want to keep synced, but not submit changes, therefore not forcing an update, should I be communicating a version number of the file, or should I be just sending the 5kb file?
I was really worried about this when I started, but now I’m thinking 5KB every 10 seconds isn’t a big deal. I was so worried about the legs until I started sending the entire file and now I think it makes sense just to track a version version the entire file (if I even need to do that).
I have zero experience with this kind of thing, and don’t know what pitfalls I might encounter, so any help would be appreciated.
PS: If you run and want to beta test, I’d love the help. There are a bunch of other runner’s “utilities” in this app.