Fix for web sockets that prevents 'buffer already freed' message when channel breaks