HI,
I have a subscription to get informed, when a channel subscription was disconnected.
The subscription is really importend, so I want to reconnect. But I cam't find a way, to reconnect.
The this.channel.connected()-Subscription is not getting fired.
init(token: string) {
this.connect(token);
this.subscribe(token)
}
connect(token) {
this.channel = this.cableService.cable(environment.cable_url, {token: token}).channel('GuestappChannel')
this.cable = this.channel.cable;
}
subscribe(token) {
this.channel.connected().subscribe(() => {
this.globals.log('Websocket connected', LogType.info, true)
})
this.channel.disconnected().subscribe(() => {
this.globals.log('Websocket disconnected', LogType.error, true)
this.connect(token);
})
}
When I load the page I have the log.
[12:07:55-541]: Websocket connected
For testing, I peform this.cable?.disconnect(); after 20 seconds.
[12:08:07-896]: Websocket disconnected
But then I can't establish a new connection.
HI,
I have a subscription to get informed, when a channel subscription was disconnected.
The subscription is really importend, so I want to reconnect. But I cam't find a way, to reconnect.
The
this.channel.connected()-Subscription is not getting fired.When I load the page I have the log.
For testing, I peform
this.cable?.disconnect();after 20 seconds.But then I can't establish a new connection.