title: Laravel socket.io broadcast to everyone except the sender
body: <p>I'm developing Laravel app with calendar events.</p>
  
  <p>I'm using socket.io to broadcast the events (as per lesson here: <a href="https://laracasts.com/lessons/broadcasting-events-in-laravel-5-1#" rel="nofollow">https://laracasts.com/lessons/broadcasting-events-in-laravel-5-1#</a>)</p>
  
  <p>my socket.js file:</p>
  
  <pre><code>var app = require('express')();
  
  var http = require('http').Server(app);
  
  var io = require('socket.io')(http);
  
  var Redis = require('ioredis');
  
  var redis = new Redis();
  
  redis.subscribe('test-channel', function(err, count) {
      // 
  });
  
  redis.on('message', function(channel, message) {
  
      console.log('Message Received! ' + message);
  
      message = JSON.parse(message);
  
      io.emit(channel + ':' + message.event, message.data);
  });
  
  http.listen(3000, function() {
      console.log('Listening on *:3000');
  });
  </code></pre>
  
  <p>It works fine but when the event is created it is pushed back to the sender and is duplicated.</p>
  
  <p>I tried to use</p>
  
  <pre><code>socket.broadcast.emit(channel + ':' + message.event, message.data);
  </code></pre>
  
  <p>instead of</p>
  
  <pre><code>io.emit(channel + ':' + message.event, message.data);
  </code></pre>
  
  <p>but the socket is not defined.</p>
  
  <p>Is there a way I can do this without sending sender ID with event and then manually checking for it in the frontend?</p>