summaryrefslogtreecommitdiffstats
path: root/webui/src/Components/WebSocketStatus.js
blob: 8c134f874b9bfe0d621cce5276296a98a515338a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import React, { Component } from 'react';
import './WebSocketStatus.scss';

class WebSocketStatus extends Component {
  render() {

    if(this.props.wsIsOpen && !this.props.wsIsAuthenticated)
      return (
        <div className="WebSocketStatus">
          Authenticating against {this.props.wsURI}
        </div>
      );

    if(this.props.wsIsRecovering)
      return (
        <div className="WebSocketStatus">
          Reconnecting to {this.props.wsURI}
        </div>
      );

    if(this.props.wsIsOpen)
      return (
        <div className="WebSocketStatus">
          Receiving real time updates from {this.props.wsURI}
        </div>
      );

    return null;
  }
}

export default WebSocketStatus;