title: Yii2 send event from php to clients using yii2-nod-socket
body: <p>I am using <a href="https://github.com/oncesk/yii-node-socket" rel="nofollow">yii2-node-socket</a> to send event to clients in a concrete room. I followed all steps to install the extension in my project, the server was started successfully and the client was connected to socket but when I tried to send event from php code the client did not receive any data.</p>
  
  <p>Javascript code:</p>
  
  <pre><code>var socket = new YiiNodeSocket();
  socket.onConnect(function () {
  socket.room('testRoom').join(function (success, numberOfRoomSubscribers) {
      // success - boolean, numberOfRoomSubscribers - number of room members
      // if error occurred then success = false, and numberOfRoomSubscribers - contains error message
      if (success) {
          console.log(numberOfRoomSubscribers + ' clients in room: testRoom');
          // do something
  
          // bind events
          this.on('join', function (newMembersCount) {
              // fire on client join
          });
  
          this.on('data', function (data) {
              // fire when server send frame into this room with 'data' event
              console.log('in data : ', data);
          });
      } else {
          // numberOfRoomSubscribers - error message
          alert(numberOfRoomSubscribers);
      }
  });
  });
  </code></pre>
  
  <p>PHP code:</p>
  
  <pre><code>    // create frame
      $frame = Yii::$app-&gt;nodeSocket-&gt;getFrameFactory()-&gt;createEventFrame();
  
      // set event name
      $frame-&gt;setEventName('data');
  
      // set room name
      $frame-&gt;setRoom('testRoom');
  
      // set data
      $frame['key'] = 'hello';
  
      // send
      $frame-&gt;send();
  </code></pre>