colyseus-unity-sdk
colyseus-unity-sdk copied to clipboard
ColyseusRoom.OnMessage<> throws exception if the sessionId exists
I clicked Join twice, and got an exception:
ArgumentException: An item with the same key has already been added. Key: msgStart
System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) (at <b89873cb176e44a995a4781c7487d410>:0)
System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) (at <b89873cb176e44a995a4781c7487d410>:0)
Colyseus.ColyseusRoom`1[T].OnMessage[MessageType] (System.String type, System.Action`1[T] handler) (at ./Library/PackageCache/io.colyseus.sdk@77fca87056/Runtime/Colyseus/Room/ColyseusRoom.cs:358)
System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) (at <b89873cb176e44a995a4781c7487d410>:0)
UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at <10871f9e312b442cb78b9b97db88fdcb>:0)
UnityEngine.UnitySynchronizationContext.Exec () (at <10871f9e312b442cb78b9b97db88fdcb>:0)
UnityEngine.UnitySynchronizationContext.ExecuteTasks () (at <10871f9e312b442cb78b9b97db88fdcb>:0)
I think it should check first, and log any errors instead of throwing exceptions.