pusher-community / pusher-realtime-chat-widget

Example Realtime Chat Widget that can be added to any web page or app.
97 stars 87 forks source link

pusher trigger not working in Development Server but works fine in local #7

Open RJayalakshmi opened 10 years ago

RJayalakshmi commented 10 years ago

Hi,

Please help me to fix this issue.

i got pusher chat real time application from the tutorial http://code.tutsplus.com/tutorials/getting-real-time-with-pusher--net-22106.

Above tutorial works fine in my local Wamp server. i have moved same code to host server in that trigger new_message event not working.

$pusher->trigger( 'presence-nettuts', //the channel 'new_message', //the event array('message' => $message) //the data to send );

above line returns 1 in local and returns none/empty in host server.

Please guide me if need any host server configuration needed?

sorry for my bad English.

zimbatm commented 10 years ago

The pusher library depends on curl to be available in PHP so maybe that's the difference. Try running phpinfo() on the server to see if that's the case.

The trigger function also accepts a debug flag. You can then print the output of the operation. This might as well give you a clue of what is happening.

$out = $pusher->trigger(
'presence-nettuts', //the channel
'new_message', //the event
array('message' => $message), //the data to send
null,
true
);
// display $out
robhawkes commented 10 years ago

@Indians, are you still experiencing this problem?

himanshuc3 commented 6 years ago

I am working on a real time timetable scheduler on MERN stack using Pusher. Somehow the req and response is coming and going fine, but the pusher trigger is not working(my assumption as axios is not getting any error and infact sending 200 status code). My code is available here: https://github.com/himanshuc3/LiveTable

gsofter commented 4 years ago

I have the same problem with him. While working on Express server on my local, the pusher trigger is working fine however, when I upload this project to heroku, nothing is triggered. Exactly, the pusher_app_id, pusher_app_secret, such all credentials are the same with local and the heroku server.

Anybody who knows the reason?

gsofter commented 4 years ago

Hey, @himanshuc3 I have tried to change the cluster of the Pusher app. When we create the Pusher app, we can choose cluster which represents your region. By default, it may be set affected by your local region. For example, if you live in India, the cluster will be ap3 which means Asian Pacific 3 ( Mumbai) Region.

So in my case, I created another Pusher app and set cluster as us3 which will work for Heroku. Now it's working fine. Hope it will also work for your case.

alex-cory commented 3 years ago

For me, I had to remove these from my config

const pusher = new Pusher({
  appId: 'APP_ID',
  key: 'APP_KEY',
  secret: process.env.PUSHER_SECRET,
  cluster: 'us2',
  // these two were causing pusher.trigger to not work on deployed server
  // useTLS: true
  // encrypted: true
})
jabir20102 commented 2 years ago

set BROADCAST_DRIVER=pusher on heroku config veriables

EzekielWachira commented 2 years ago

set BROADCAST_DRIVER=pusher on heroku config veriables

This one worked for me, thanks