fix for stack overload due to multiple 'offline' events

Simple fix for multiple `offline` events leading to error - `"RangeError: Maximum call stack size exceeded"`