diff --git a/src/ui/NotifPage.js b/src/ui/NotifPage.js index e240efe..50bb253 100644 --- a/src/ui/NotifPage.js +++ b/src/ui/NotifPage.js @@ -7,17 +7,27 @@ export default class NotifPage extends React.Component { super(props); this.state = { - haveperm: false + haveperm: false, + connected: false } } componentDidMount() { + this.connect(); + } + + connect() { let socket = io.connect(); let room = this.props.urlid; socket.on('connect', () => { socket.emit('room', room); + this.setState({connected: true}); + + socket.on('disconnect', () => { + this.setState({connected: false}); + }); }); socket.on('message', (data) => { @@ -56,8 +66,16 @@ export default class NotifPage extends React.Component { Check Again } - { this.state.haveperm && supported &&
- This page is now monitoring for notifications. + { !this.state.connected && supported &&
+ Error: Unable to connect to the Notica server :( +
++ Attempting to reconnect... +
++ This page is monitoring for notifications.
}