neopusher with 2 channels - Forum

Forum Navigation
You need to log in to create posts and topics.

neopusher with 2 channels

Good morning @Luishp

I try to use 2 channels inside my chat app but I have a problem with neoPusherSend for the 2nd channel, I do not receive the message. I wonder if there is a conflict with neo functions and the configuration of index.php ?

?php
header("Access-Control-Allow-Origin: *");
require __DIR__ . '/vendor/autoload.php';

$options = array(
'cluster' => 'eu',
'useTLS' => true
);
$pusher = new Pusher\Pusher(
'key1',
'key2',
'key3',
$options
);

$pusherB = new Pusher\Pusher(
'key4',
'key5',
'key6',
$options
);

$input_data = $_POST;
$theChannel = $_POST['channel'];
$theEvent = $_POST['event'];

$pusher->trigger($theChannel, $theEvent, $input_data);
$pusherB->trigger($theChannel, $theEvent, $input_data);
?>

initialization pusher :

neoPusherInitialize "key1" "eu" "[url]" true
neoPusherSubscribe "lpg78" "new-message" "parsedata"
IfEx [Groupe] == "admin" or [Groupe] == "bureau"
SetVar [Channel] "B"
neoPusherInitialize "key4" "eu" "[url]" true
neoPusherSubscribe "lpg78B" "new-message" "parsedata"
GotoPage "reseau"
Else
SetVar [Channel] "C"
GotoPage "sms"
Endif

pushbutton send :

If [Channel] == "C"
neoPusherSend "lpg78" "new-message" [clientData] "" ""
Else
neoPusherSend "lpg78B" "new-message" [clientData] "" ""
Endif

additional precision, when I examine the debug console of pusher, I see the messages sent whatever the channel in the 2 channels.

Hi @phil78, attached is neoPusher plugin source code.
As you can see it's really simple and it follows Pusher API instructions.
I do really have no time to look into this, but I hope the source code will help you to understand what's happening in your project.

Best regards,

 

Uploaded files:
  • You need to login to have access to uploads.

thanks @luishp,  I had misunderstood how channels and apps are related. After a contact with pusher support it is clear now, I do not need 2 channels but 2 messages name.

Best regards.

luishp has reacted to this post.
luishp

Great! Good to know :)