Comments (7)
I'm apologize for this issue, this is my fault after fixed this issue in the Firebase-ESP32 and Firebase-ESP8266 Client libraries and forgot to update in this Firebase ESP Client library.
Please replace this message/FCM.cpp
https://github.com/mobizt/Firebase-ESP-Client/blob/main/src/message/FCM.cpp
with this gist version of FCM.cpp
https://gist.github.com/mobizt/56a4868478d9d16e7682dbf2f4de9a8d
The next library update will fix with this updated file.
from firebase-esp-client.
The library update v2.1.0 is available with the bugs fixed.
from firebase-esp-client.
You should update the library to latest version and try again.
from firebase-esp-client.
After you update the library, you need to follow this example.
from firebase-esp-client.
Hello, I'm sorry to tell you that the problem has not been resolved. The libraries on the ESP8266 are in their latest version, in the App too. In addition, it should be clarified that from the Node js script I can receive without problems.When analyzing the message with breakpoint I find the following:
category: null
contentAvailable: false
data: Map (3 items)
- 0: "timestamp" -> "1609815454"
- 1: "unit" -> "celsius"
- 2: "temp" -> "28"
from: "611618541995"
messageId: "0: 1619149528235791% 0353096bf9fd7ecd"
messageType: null
mutableContent: false
notification: null
senderId: null
sentTime: DateTime (2021-04-23 00: 45: 28.232)
threadId: null
from firebase-esp-client.
I leave my code to be able to analyze it. Although I have only inserted the Token, Wifi credentials and removed comments and console impressions. Muchas gracias por contestar!
#if defined(ESP32)
#include <WiFi.h>
#elif defined(ESP8266)
#include <ESP8266WiFi.h>
#endif
#include <Firebase_ESP_Client.h>
#define WIFI_SSID ""
#define WIFI_PASSWORD ""
#define FIREBASE_FCM_SERVER_KEY "*"
#define DEVICE_REGISTRATION_ID_TOKEN "*"
FirebaseData fbdo;
unsigned long lastTime = 0;
int count = 0;
void sendMessage();
void setup()
{
Serial.begin(115200);
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
Serial.print("Connecting to Wi-Fi");
while (WiFi.status() != WL_CONNECTED)
{
Serial.print(".");
delay(300);
}
//required for legacy HTTP API
Firebase.FCM.setServerKey(FIREBASE_FCM_SERVER_KEY);
Firebase.reconnectWiFi(true);
#if defined(ESP8266)
//Set the size of WiFi rx/tx buffers in the case where we want to work with large data.
fbdo.setBSSLBufferSize(1024, 1024);
#endif
//Set the size of HTTP response buffers in the case where we want to work with large data.
fbdo.setResponseSize(1024);
sendMessage();
}
void loop()
{
if (millis() - lastTime > 60 * 1000)
{
lastTime = millis();
sendMessage();
}
}
void sendMessage()
{
FCM_Legacy_HTTP_Message msg;
msg.targets.to = DEVICE_REGISTRATION_ID_TOKEN;
msg.options.time_to_live = "1000";
msg.options.priority = "high";
msg.payloads.notification.title = "Notification title";
msg.payloads.notification.body = "Notification body";
msg.payloads.notification.icon = "myicon";
msg.payloads.notification.click_action = "OPEN_ACTIVITY_1";
FirebaseJson json;
String payload;
//all data key-values should be string
json.add("temp", "28");
json.add("unit", "celsius");
json.add("timestamp", "1609815454");
json.toString(payload);
msg.payloads.data = payload.c_str();
if (Firebase.FCM.send(&fbdo, &msg)) //send message to recipient
{
Serial.println("PASSED");
Serial.println(Firebase.FCM.payload(&fbdo));
}
else
{
Serial.println("FAILED");
Serial.println("REASON: " + fbdo.errorReason());
}
count++;
}
from firebase-esp-client.
The library works as normally and has been tested before it published.
I also test with Android and Web client again before I post this comment to confirm.
The result is already show the status of your message sending.
Serial.println("REASON: " + fbdo.errorReason());
from firebase-esp-client.
Related Issues (20)
- "Connection Refused" After a few successful uploads to RTDB HOT 11
- RTDB.setQueryIndex() fails with "security rules is not a valid JSON" HOT 10
- How to check if a directory exists in Firebase Storage?T HOT 2
- connection refused HOT 7
- connection refused
- connection refused HOT 1
- Storage.download function corrupts memory and clears file list HOT 3
- Using as component in esp idf not compiling HOT 1
- ENHANCEMENT HOT 1
- Token error: code: -1, message: Missing required parameter: assertion` on AUTH 2.0 HOT 2
- Parsing json response incorrectly HOT 1
- ESP8266 reboot issue during Firebase OTA firmware update from stogare HOT 1
- No more processes HOT 21
- Non-blocking token request method HOT 2
- Firestore Get, Query, List examples returns incorect document name in payload HOT 1
- Programm gets stuck in Firebase.begin(&config, &auth) after User Enters wrong Email or Password HOT 7
- token usage with Alexa skills or Google assistant HOT 2
- i have a problem with my code that disconects the tcp connection after few minutes HOT 9
- Filename or extension is too long HOT 2
- Unable to Connect to Firebase Realtime Database via Router, Works Fine with Mobile Data HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from firebase-esp-client.