title: Laravel Echo callback
body: <p>I'm looking into Laravel Echo (With socket.io as connector)</p>
  
  <p>But I can't find out how to bind a <strong>callback</strong> when user/visitor succeed or not connecting to the socket (Not channel), but generally if connected.</p>
  
  <pre><code>import Echo from "laravel-echo"; //import Laravel-echo
  
  if(typeof(io) != 'undefined'){ //check if io loaded
      //init Echo
      window.Echo = new Echo({
          broadcaster: 'socket.io',
          host: { path: '/socket.io' }
      });
  }
  </code></pre>
  
  <p>So here I do check if <strong>io</strong> exist, then most probably socket is up.</p>
  
  <p>But can we bind a callback like we can do with socket.io:
  Example from socket.io docs</p>
  
  <pre><code>const socket = io('http://localhost');
  
  console.log(socket.id); // undefined
  
  socket.on('connect', () =&gt; {
    console.log(socket.id); // 'here we can get socket id'
  });
  </code></pre>
  
  <p>The reason why I need a callback is to get the socket id and initiate other scripts.</p>