Skip to content

Ability to auto reconnect #7

@Boscop

Description

@Boscop

It would be useful to have an attribute for the ability to auto reconnect in case of a failed connection.
Currently I'm using this code to try reconnecting in 3s intervals:

      _handleWsClose: function(e) {
        var i = setInterval(function() {
          if(this.wsStatus === 0) {
            clearInterval(i);
          } else {
            this.$.socket.close();
            this.$.socket.open();
          }
        }.bind(this), 3000);
      },

But I think it would be useful to have this in the element.
So there could be an attribute for the auto reconnect interval, the default could be null so that it won't auto reconnect by default, only when the attribute is given.
E.g. it could be reconnect-interval="3000"

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions