@@ -223,6 +223,10 @@ impl StreamingSyncIteration {
223223 SyncEvent :: TearDown => break ,
224224 SyncEvent :: TextLine { data } => serde_json:: from_str ( data) ?,
225225 SyncEvent :: BinaryLine { data } => bson:: from_bytes ( data) ?,
226+ SyncEvent :: DidRefreshToken => {
227+ // Break so that the client SDK starts another iteration.
228+ break ;
229+ }
226230 } ;
227231
228232 match line {
@@ -290,8 +294,9 @@ impl StreamingSyncIteration {
290294 SyncLocalResult :: ChangesApplied => {
291295 event. instructions . push ( Instruction :: LogLine {
292296 severity : LogSeverity :: DEBUG ,
293- line : format ! ( "Validated checkpoint" ) ,
297+ line : format ! ( "Validated and applied checkpoint" ) ,
294298 } ) ;
299+ event. instructions . push ( Instruction :: DidCompleteSync { } ) ;
295300
296301 let now = self . adapter . now ( ) ?;
297302 self . status . update (
@@ -347,7 +352,19 @@ impl StreamingSyncIteration {
347352 . update ( |s| s. track_line ( & data_line) , & mut event. instructions ) ;
348353 insert_bucket_operations ( & self . adapter , & data_line) ?;
349354 }
350- SyncLine :: KeepAlive ( token_expires_in) => todo ! ( ) ,
355+ SyncLine :: KeepAlive ( token) => {
356+ if token. is_expired ( ) {
357+ // Token expired already - stop the connection immediately.
358+ event
359+ . instructions
360+ . push ( Instruction :: FetchCredentials { did_expire : true } ) ;
361+ break ;
362+ } else if token. should_prefetch ( ) {
363+ event
364+ . instructions
365+ . push ( Instruction :: FetchCredentials { did_expire : false } ) ;
366+ }
367+ }
351368 }
352369 }
353370
0 commit comments