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

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

Open
stelcheck opened this issue Sep 11, 2017 · 0 comments
Assignees

Comments

@stelcheck
Copy link
Member

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;
        });
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

2 participants