sourc7 / fcmstream Goto Github PK
View Code? Open in Web Editor NEWFirebase Cloud Messaging XMPP protocol app server written in pure PHP.
License: MIT License
Firebase Cloud Messaging XMPP protocol app server written in pure PHP.
License: MIT License
i tried running it today and it immediately exited with error ..
PHP Parse error: syntax error, unexpected 'exit' (T_EXIT), expecting identifier (T_STRING) in /home/user/bin/garagejs/FCMStream/stream.php on line 118
Looks like this project does not work anymore with new FCM server key.
Running at PHP 7 and fixing incorrect "?>" in one of scripts I was finally getting some output from service.php like below.
As for service.php variable 'api_key' - looks like FCM is expecting new "Server key" (like AAAAfJORI48:APA91...), not "Legacy server key" (like AIzaSyDX..) from its console - Cloud messaging. With new key I have no output at all.
With old key I got error
=== Connecting to fcm-xmpp.googleapis.com:5235... === 07:33:32 === === Sent 129 bytes === 07:33:32 === === Read 152 bytes === 07:33:32 === === Read 197 bytes === 07:33:32 === X-OAUTH2X-GOOGLE-TOKENPLAIN === Sent 169 bytes === 07:33:32 === ADUzNTA1MTcwNzI3OUBnY20uZ29vZ2xlYXBpcy5jb20AQUl6YVN5QzFNOHJUa2tMVnBYb0NPT055bklodmJr === Read 194 bytes === 07:33:32 === Received BROWSER API key. Only SERVER API keys are accepted. === Read 16 bytes === 07:33:32
I got in touch with FB support and got reply:
Based off the error, looks like you're using the wrong key. You should be using the FCM server key. This can be found in the Firebase Console under the Project Settings -> Cloud Messaging.
see details at https://stackoverflow.com/questions/50004547/firebase-cloud-messaging-returns-received-browser-api-key-only-server-api-keys
Hi, I am trying to convert my project from using the http to xmpp protocol to receive upstream messages and decided to try out your code. I used the sender_id and api_key which I already had from my working project. When starting the service from the shell the sasl authentification fails. Here is the log from my shell:
$ php FCMStream/service.php === Connecting to fcm-xmpp.googleapis.com:5235... === 11:42:40 === === Sent 129 bytes === 11:42:41 === <stream:stream to="fcm-xmpp.googleapis.com" version="1.0" xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams"> === Read 152 bytes === 11:42:41 === <stream:stream from="fcm-xmpp.googleapis.com" id="/*id.....*/" version="1.0" xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client"> === Read 197 bytes === 11:42:41 === <stream:features><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>X-OAUTH2</mechanism><mechanism>X-GOOGLE-TOKEN</mechanism><mechanism>PLAIN</mechanism></mechanisms></stream:features> === Sent 321 bytes === 11:42:41 === <auth mechanism="PLAIN" xmlns="urn:ietf:params:xml:ns:xmpp-sasl">/*authentification_id....*/==</auth> === Read 77 bytes === 11:42:41 === <failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><not-authorized/></failure> === Read 16 bytes === 11:42:41 === </stream:stream> === Read 0 bytes === 11:42:41 === === Read 0 bytes === 11:42:41 === === Read 0 bytes === 11:42:41 === === Read 0 bytes === 11:42:41 === === Read 0 bytes === 11:42:41 === === Read 0 bytes === 11:42:41 === === Read 0 bytes === 11:42:41 ===
Documentation is not clear.
private function read($socket) {
$response = fread($socket, 1389);
echo 'read function';
After getting auth it goes in loop , i think its read function where it stuck.
=== Connecting to fcm-xmpp.googleapis.com:5236... === 08:24:18 === === Sent 129 bytes === 08:24:19 === read function=== Read 152 bytes === 08:24:20 === read function=== Read 197 bytes === 08:24:20 === X-OAUTH2X-GOOGLE-TOKENPLAIN === Sent 321 bytes === 08:24:20 === XXXXXX............................XXXXXXXXXXXXXXXXW9ORHh4N29aV0w1eGJRd0JweXZDckljRDliS3dGMUg= read function=== Read 51 bytes === 08:24:20 === === Sent 129 bytes === 08:24:20 === read function=== Read 152 bytes === 08:24:20 === read function=== Read 137 bytes === 08:24:20 === === Sent 173 bytes === 08:24:20 === test === Sent 148 bytes === 08:24:20 === read function=== Read 207 bytes === 08:24:21 === [email protected]/test403BFA94 === Streaming FCM Cloud Connection Server... === 08:24:21 === read function=== Read character 32 === 08:24:21 === === Keepalive exchange === 08:24:21 === === Sent 2 bytes === 08:24:21 === read function=== Read 94 bytes === 08:24:21 ===
Fatal error: Maximum execution time of 30 seconds exceeded in C:\xampp\htdocs\FCMStream-master\stream.php on line 193
This is What i Got.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.