I tried to use pusher extension but it dose not work for me. Did some tests on the weekend:
Installed Versions
Flarum core 0.1.0-beta.7
EXT flarum-pusher v0.1.0-beta.6
PHP 5.6.32
Tests
- Deleted extension flarum-ext-pusher
- composer update (re-installed it - got version 2.6.4)
- Activated extension in backend and input my configrations
(tryed it with two applications mt1 and eu)
- Opend Pusher Debug Console on Pusher.com page
- Opend tail -f on php log and flarum log on my server
- Opend two browsers FF (latest) and Chrome (latest) - both got connected in Pusher Debug Console
- Send a post in chrome - got email notification - but no push update - no message on Pusher Debug Console
- Send a post in firefox - got email notification - but no push update - no message on Pusher Debug Console
- Checked open tail -f commands on log files - no issues
- Copied Curl example from Pusher page and executed it via terminal on my server - Yeha - Message was triggerd on Pushe Debug Console
- Copied PHP example form Pusher page and made a pushertest.php on the server - Called it - Massage was triggered again
- Copied Javascript example via browser console into the opend flarum windows
- Triggerd Curl on the server again - "Hello World" appears on both windows and Pusher Debug Console
- Triggerd my PHP example page again - "Hello World" appears on both windows and Pusher Debug Console
- Nothing on Pusher Error Logs
php file on server triggered via browser (works)
require __DIR__ . '/vendor/pusher/pusher-php-server/lib/Pusher.php';
$options = array(
'cluster' => 'eu',
'encrypted' => true
);
$pusher = new \Pusher(
'something',
'something',
'something',
$options
);
$data['message'] = 'hello world';
$pusher->trigger('my-channel', 'my-event', $data);
Curl test via ssh trminal on server (works)
curl -H 'Content-Type: application/json' -d '{"data":"{\"message\":\"hello world\"}","name":"my-event","channel":"my-channel"}' \
"https://api-eu.pusher.com/apps/something/events?"\
"body_md5=something&"\
"auth_version=1.0&"\
"auth_key=something&"\
"auth_timestamp=1513599992&"\
"auth_signature=something&"
Javascript Example entered in Browser console (Worked)
// Enable pusher logging - don't include this in production
Pusher.logToConsole = true;
var pusher = new Pusher('somthing', {
cluster: 'eu',
encrypted: true
});
var channel = pusher.subscribe('my-channel');
channel.bind('my-event', function(data) {
alert(data.message);
});
Summary
- Browser are connecting to pusher
- My Server can reach Pusher and triggers "Hello World" messages
- Pusher Examples are working fine
- Flarum posts do not trigger any message on Pusher Debug Console
Conclusion
- Flarum php integration is not triggering a message or has an issue
Maybe because of SSL usage? My test form is using SSL.
Any ideas what to check next?
Update concerning The_F4m3
Changes are made in dev-master. So it changed in composer.json version to dev-master makes no big difference. One time a api-message ist appearing. But creating a second post dose not trigger any event.
API Message Channel: private-user1, Event: notification, 13:19:38 Message: null
Update concerning Ranger
I tried this also. It did not work for me.