title: How can i receive emit response within laravel
body: <p>I am using socket.io and node.js for a socket connection, I am sending data via API to a socket using below laravel code.</p>
  
  <p>its working perfect after all procedure in a socket.js file which is running in a terminal with node socket.js. I just want a response on the same function where I publish the event, is it possible with this or I need to do something else. </p>
  
  <p><strong>Note:</strong> everything is perfect just need a response in the same function where I publish</p>
  
  <p>Thanks</p>
  
  <pre><code>namespace App\Http\Controllers;
  
  use Illuminate\Http\Request;
  use Auth;
  use App\Http\Requests;
  use LRedis;
  class MessageController extends Controller{
      public function store(Request $request){
  
              $data = [
                  'id'=&gt;1,
                  'game_name'=&gt;'PUB',
  
              ];
              $redis = LRedis::connection();
              $redis-&gt;publish('message', json_encode($data));
      }
  }
  </code></pre>
  
  <p>////// node node.js</p>
  
  <pre><code>var app = require('express')();
  var server = require('http').Server(app);
  var io = require('socket.io')(server);
  var redis = require('redis');
  server.listen(3000, function () {
      console.log('Listening on Port 3000');
  });
  
  
  redisClient.subscribe('message');
  
  redisClient.on("message", function (channel, data) {
      const dataj = JSON.parse(data);
      console.log(data);
  
      ///// send data to client which is connected with me 
      io.emit("eventsend", {
          "id": dataj.id,
          "game": dataj.game,
  
      });
  
  });
  
  io.on('connection', function (socket) {
  
  
  
      /////////////////////// send by client
      socket.on("eventrec", function (data) {
  
          console.log(data);
  
      });
  
      //console.log("Connected!");
  
  
      /////////////////////// send by client 
  
      socket.on("success_repo", function (data) {
          ////////// i want this response in my laravel file where i publish the message event 
          console.log(data);
      });
  
      socket.on('disconnect', function () {
  
          redisClient.unsubscribe('message');
  
  
      });
  
  });
  </code></pre>