subscribeRealtime method
Subscribe to server-pushed config updates: on a new publish, re-fetch. Requires an active realtime connection. Safe to call more than once.
Implementation
Future<void> subscribeRealtime(NexusRealtime realtime) async {
if (_realtime != null) return;
_realtime = realtime;
try {
await realtime.join(kRemoteConfigRoom);
realtime.on('config_updated', (_) {
NexusLog.debug('remote-config: realtime update — re-fetching');
unawaited(fetch());
});
NexusLog.info('remote-config: realtime updates on');
} catch (e, st) {
NexusLog.warn('remote-config: realtime subscribe failed: $e');
NexusLog.debug('$st');
}
}