2017-03-08 47 views
2

我試圖在房間內設置最多兩個人的在線教室...仍然我不想讓老師看到他何時連接,當學生連接時。如何顯示有多少用戶在推送頁面上

我想toget的用戶連接數使用推杆members.me功能,但我得到的是說,錯誤...

成員是不確定的

這裏是我的代碼:

$(function(){ 
    /** 
    * 
    */ 
    var pusher = { 
     /** 
     * 
     */ 
     init: function(){ 
      this.p = new Pusher('12345678910', { 
       cluster: 'eu', 
       authEndpoint: '<?php echo base_url('websockets/auth'); ?>', 
       // encrypted: true 
      }); 

      // channels 
      this.channel1 = this.p.subscribe('private-messages'); 
      this.channel2 = this.p.subscribe('private-slides'); 

      // binding channels to events 
      this.channel1.bind('client-message-triggered', function(data){ 
       chatbox.showMessage(data); 
      }); 
      this.channel2.bind('client-slide-triggered', function(data){ 
       users = pusher.channel2.members.me; 
       console.log(users); 
       slider.showCard(data.card_id); 
      }); 
     }, 
    } 
    pusher.init(); 

問:

如何獲得使用頻道的用戶數量(例如上面的頻道2)?

回答

相關問題