Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ColyseusRoom.OnMessage<> throws exception if the sessionId exists #221

Open
Alaadel opened this issue Jan 13, 2024 · 0 comments
Open

ColyseusRoom.OnMessage<> throws exception if the sessionId exists #221

Alaadel opened this issue Jan 13, 2024 · 0 comments

Comments

@Alaadel
Copy link

Alaadel commented Jan 13, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant