darwinmorochoOriginal post
Rank 1: Thread
Hi I have installed appwrite in my ubuntu server with docker and nginx. Due to my server already has some apps running with pm2 I had to run my appwrite app using a reverse proxy.
When I use the next code to subscribe to realtime events it works for a few seconds
Dart
final Realtime _realtime = Realtime(client);... final userChannel = 'databases.my_db.collections.users.documents.$userId'; final membershipChannel = 'databases.my_db.collections.memberships.documents.$userId'; // this works for around 30 seconds, after that time the appwrite sdk throws // Unhandled Exception: Concurrent modification during iteration: _Map len:0.// And the realtime stop working _subscription = _realtime.subscribe( [userChannel, membershipChannel], );Next after a few seconds I have this error in my console and the realtime stops working
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Concurrent modification during iteration: _Map len:0.
#0 _CompactIterator.moveNext (dart:collection-patch/compact_hash.dart:714:7)
#1 RealtimeMixin._createSocket.<anonymous closure> (package:appwrite/src/realtime_mixin.dart:91:49)
#2 _RootZone.runGuarded (dart:async/zone.dart:1582:10)
#3 _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:392:13)
#4 _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:402:7)
#5 _BufferingStreamSubscription._close (dart:async/stream_impl.dart:291:7)
#6 _ForwardingStream._handleDone (dart:async/stream_pipe.dart:99:10)
#7 _ForwardingStreamSubscription._handleDone (dart:async/stream_pipe.dart:161:13)
#8 _RootZone.runGuarded (dart:async/zone.dart:1582:10)
#9 _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:392:13)
Summary
Developers are encountering a 'Concurrent modification during iteration' error when using RealTime subscribe with appwrite SDK, which causes the RealTime to stop working after about 30 seconds. This issue arises while attempting to subscribe to realtime events. The error message indicates a problem with a _Map.