While making a simple login webpage to test different users being able to log in and out of sessions, I can open a new router session with a new user, but the webpage console log indicates no valid session instance from within connection.onopen().
What I tried:
To logout old user, I call connection.close(), then I change user/secret. Then I call connection.open. At first this didn’t work at the router, and I learned by looking at router logs that connection.open does not refresh the fields within var connection = new autobahn.Connection(). So I manually refreshed the connection variable with the new user info, and indeed that worked to start a new session at the router. However, at the client (webpage), console.log shows no valid autobahn.session instance.
Of course it works fine if I reload the browser as that reloads the entire js including connection.onopen = function(), but I’m trying to enable new users to login and out without refreshing the browser. I feel like this is a basic functionality and I’m missing something obvious!
I looked but did not find any actual web-page authentication code example with, say a simple button and text fields to change users/secrets and call connection.open() again to get a new session going without refreshing browser.