I am creating a 2d tile for iOS with Fast and Firebase. Since the world is big, I designed it so that I only subscribe to the tiles that are on the screen. That is, instead of adding listeners for all 10,000x10,000 fragments, I add them only to fragments on the screen. When a player moves, I de-register old listeners and register new ones. I added a little buffer zone around the edge of the screen, in the hope that everything would be loaded enough by the time it moves around the screen. Unfortunately, often there is a fairly significant lag behind Firebase that this strategy simply does not work. On suboptimal Internet connections, you can continue to go to the "unloaded world", taking a few seconds to download the missing fragments.
Here it is, though: other iOS MMO games on the same connection and the same device work fine. This is not a terrible connection. It makes me suspect my implementation, or Firebase itself is to blame.
Basically, I expect a one time event for about 20 fragments every time I take a step. The step takes about 1/4 of a second, so every second I request about 100 items from Firebase. However, I cannot think of a better way. The Firebase documentation suggests that this should not be a problem, as it is all one socket connection. I could “load” objects in, say, 10x10 blocks, which would mean that I would subscribe to fewer objects, but it would also be more useless in terms of complete data transfer. If the socket connection is indeed optimized, the overall data transfer should be the only bottleneck, implying that this strategy will be wrong.
change
, . -1, . , , . , . http://forevermaze.inzania.com/videos/FirebaseLag.mov (nb, . , , . .)
, . . , , 20 , . . MiFi LTE- , .
static func loadSnapshot(firebasePath: String!) -> Promise<FDataSnapshot?> {
let (promise, fulfill, _) = Promise<FDataSnapshot?>.pendingPromise()
let connection = Firebase(url: Config.firebaseUrl + firebasePath)
connection.observeSingleEventOfType(.Value, withBlock: { snapshot in
if !promise.resolved {
fulfill(snapshot)
}
})
after(Config.timeout).then { () -> Void in
if !promise.resolved {
DDLogWarn("[TIMEOUT] [FIREBASE-READ] \(firebasePath)")
fulfill(nil)
}
}
return promise
}
[ROOT]/tiles/[X]x[Y]. , (.. ), . Firebase:

edit2
. 100- XCTestCase : http://forevermaze.com/code/LagTests.swift
:
- Swift ( , Firebase)
firebaseUrl URL (.. https://MyProject.firebaseio.com)testSetupDatabase() ,testWalking(), . . , - 2 .
. , LTE MiFi . 2 seconds -, , 10 tile (0,2 * 10 = 2 ). , LTE, , 10 (!!):
error: -[ForeverMazeTests.LagTests testWalking] : XCTAssertTrue failed - Tile 2x20 took 9.50058007240295