Skip to content

Current messageStream message queue and ids need to be reset if a session is lost #1

Open
@stelcheck

Description

@stelcheck

Originally reported by @AlmirKadric

When a session is lost we're not resetting the current message ids and message list on the client. This is a problem as the backend will begin counting at 1 again. So all messages from 1 to current counter will be ignored and then start processing after the current message.

Although generally we restart the client when we lose a session, we should still handle this for any use cases we may have.

Something we already agreed on with the C# client

        // Start transport client when session is acquired
        mage.eventManager.on ("session.set", (object sender, JObject session) => {
            _sessionKey = UnityEngine.WWW.EscapeURL(session["key"].ToString());
            transportClient.start();
        });

        // Stop the message client when session is lost
        mage.eventManager.on ("session.unset", (object sender, JObject session) => {
            transportClient.stop();

            currentMessageId = -1;
            largestMessageId = -1;
            messageQueue = new Dictionary<int, JToken>();
            confirmIds = new List<string>();

            _sessionKey = null;
        });

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions