lajosbencz / vue-wamp

AutobahnJS wrapper library fo Vue.js
MIT License
48 stars 13 forks source link

Subscription does not work if app cannot connect to server when launched #15

Closed vstokarev closed 5 years ago

vstokarev commented 6 years ago

This library can re-subscribe/register if connection was lost and then re-established and that is really great. But the problem is that this approach does not work if there were no server connection at the time application was launched.

I checked the following scenario:

  1. Shut down the server.
  2. Launched Vue app.
  3. Waited for about 1 min and then launched the server again. I saw that onopen() event fired, but I didn't get any data updates, because application never subscribed to anything. And if I restart the page - everything works fine.

I could possibly call page reload from JS, but there is no way how I can know if subscriptions worked or not. And I don't want to reload the whole page every time the app reconnects.

It would be great if you could fix subscriptions for the applications that start without real connection to server and successfully establish the connection later. And/or add onsubscribe() event, so it will be possible to process this case on application's side. Thank you.

lajosbencz commented 5 years ago

Should be working since v2.0.0.

The caveat is that it will only resubscribe/reregister if the connection was regained while retrying. If you re-open the connection with $wamp.open() after connection loss, notthing will be re-established, you will have to do that manually.