0

I've implement chat with pusher and it works fine. But the problem is everyone can see it, there is no restriction to hide or make it private. How to make it private one to one chat room that other users can't able to see their conversations. I've call widget like this:

jQuery(function() {     
        var pusher = new Pusher("MY_APP_KEY" , { authEndpoint: '/pusher_auth.php' })
        var chatWidget = new PusherChatWidget(pusher, {
          appendTo: "#pusher_chat_widget"
        });
      });

and in pusher_auth.php

global $user;
if ($user->uid)
{
  $pusher = new Pusher(APP_KEY, APP_SECRET, APP_ID);
  echo $pusher->socket_auth($_POST['channel_name'], $_POST['socket_id']);
}
else
{
  header('', true, 403);
  echo "Forbidden";
}

so please tell me how its possible, Thanks.

Jay Blanchard
  • 34,243
  • 16
  • 77
  • 119
  • Welcome to StackOverflow! None of the code you posted has anything to with securing a chat room. Can you share what you have tried regarding that? – Jay Blanchard Apr 09 '15 at 12:51
  • I am new to real time world so can you please explain the procedure for having a private chat.I will implement that and if still i will get a problem then i will post you the code. Thanks – Gurmeet Singh Apr 09 '15 at 12:57
  • That is not how SO works, that is much too broad a question. You'll need to do some actual research and coding. If you have issues with your code were are here to help. – Jay Blanchard Apr 09 '15 at 12:58
  • possible duplicate of [Pusher one to one chat structure](http://stackoverflow.com/questions/27375125/pusher-one-to-one-chat-structure) – leggetter Apr 09 '15 at 13:34
  • Hi @JayBlanchard , i am new in this pusher programing please tell me what you want to know about my code i can provide you my code file...please tell me your email id...please help me to create my app – Gurmeet Singh Apr 10 '15 at 08:27
  • hi leggetter, i was trying to implement your solution that you answered in another almost same question. i have faced one problem with that. When i tried to call trigger function in my javascript file. pusher.trigger( channels, 'one-to-one-chat-request', eventData ); It returns : TypeError: pusher.trigger is not a function, have any idea to solve this ?? – Gurmeet Singh Apr 25 '15 at 09:35

0 Answers0