I want to know when my users are getting errors connecting or the connection drops out. I've read a lot saying this is possible but I'm getting no where and I'm starting to think it maybe an issue with a third party like https://github.com/beyondcode/laravel-websockets which I am using, has anyone had any issues with this?
The following yields no logs at all.
window.Echo.connector.pusher.bind('reconnect', (channel, data) => {
console.log('RE-CONNECTED');
});
window.Echo.connector.pusher.bind('reconnecting', (channel, data) => {
console.log('re-connecting...');
});
window.Echo.connector.pusher.bind('reconnect_error', (channel, data) => {
console.log('reconnection error!');
});
window.Echo.connector.pusher.bind('reconnect_attempt', (channel, data) => {
console.log('re-connecting...');
});
window.Echo.connector.pusher.bind('connect_error', (channel, data) => {
console.log('connect error...');
});
window.Echo.connector.pusher.bind('error', (channel, data) => {
console.log('error...');
});
window.Echo.connector.pusher.bind_global((channel, data) => {
console.log(channel, data);
});
If I use something like this which is being suggested
window.Echo.connector.socket.on('connect_error', function(){
console.log('connected', window.Echo.socketId());
});
window.Echo.connector.socket.on('connect', function(){
console.log('connected', window.Echo.socketId());
});
window.Echo.connector.socket.on('disconnect', function(){
console.log('disconnected');
});
window.Echo.connector.socket.on('reconnecting', function(attemptNumber){
console.log('reconnecting', attemptNumber);
});
I get Uncaught TypeError: Cannot read property 'on' of undefined