Skip to content

Implement websocket reconnect #26

@FabioRosado

Description

@FabioRosado

On v1 we have a reconnect method that is triggered when we lose connection or when we change the websocket URL. We should implement a similar thing in v2.

For reference:

  reconnectToWebSocket() {
    if (this.active_connection && this.active_connection.connected) {
      this.active_connection.close();
    }
    if (this.connectionTimeout) {
      clearTimeout(this.connectionTimeout);
    }
    console.log(`Reconnecting in ${this.connectionCooldown} seconds.`);
    this.connectionTimeout = setTimeout(this.connectToWebsocket, this.connectionCooldown * 1000);
    this.backoffCooldown();
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    opsdroid-web-v2Issues related to the upcoming version of opsdroid web

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions