-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pushListener not called on new messages #8
Comments
Hi @waterman76 this is likely to be a setup issue I expect. You can check your Firebase database: It should look like this. As you can see the from field exists. Can you check your database and see if this field exists. It could be that your test using GCP isn't representative. Can you send me a screenshot from your Firebase Console -> Functions -> Push listener -> Logs? Also, can you tell me which version of the client you are using? For reference, I'm using the cloud functions script and it's working fine. So I think it's likely a configuration issue. |
We're using the latest Chat SDK codebase. |
@waterman76 thanks for that information. Can you also send me the screenshot from your Firebase Console -> Functions -> Push listener -> Logs? |
This is the JSON that was used to test the function: { "messages_dev" : { |
I think it will fail if it's not started by Firebase because the message data will be null. I'm not sure why your functions are not being triggered. Are you using more than one real-time database? If you can give me access to your firebase [email protected] I can have a quick look. |
I have given you Viewer access to our Firebase account |
Hi @waterman76 thanks! From looking at your data in the dev environment at least, all the threads are empty apart from a few where the messages were sent on the 24th of August. Can you try deleting the threads and making one test thread and sending some messages? |
Hi. |
Ok, have you added the Firebase rules? Do you see any error message from the client? |
We have resolved the problem that prevented the messages to be pushed to firebase db. We also see pushListener invocations, triggered by new messages. We're not able to verify that notifications are working due to a new issue - we're not able to join 2 users in a chat. This was working, but now as soon as we call: we receive an error: We're calling addUsers from the 2nd device(user) to join this user to a chat that was created on the 1st device. |
Hi @waterman76 you can't call add the user from the second device. There is security in place which means that only a thread owner can add another user. The thread creator needs to add the second user. |
Thanks for this clarification. One final question - can updates to the local user profile be pushed to firebase DB? We're calling .setName(), .setMetaValue(), .setImageURL() on CDUser instance but the data in \users{user-id} is not updated. |
We're calling BChatSDK.db().save() after setting the user properties. |
Try: [BChatSDK.core pushUser] |
Hello. pushUser works, but we are still not able to add a user to a thread. As advised, we're calling .addUsers() from the thread owner account but we don't see the new user being joined to the thread in firebase db. It seems that the new user is added, but only in the device cache. Our code looks like this: We were unable to find a "pushThread" call - is there a call that pushes the thread user list changes? |
Hi @waterman76 if you check this page in the documentation https://chat-sdk.gitbook.io/chat-sdk/guides/api-cheatsheet#messaging-server-api It says:
That means that if you want to do something that will affect the server, like adding a user to a thread, you will need to use one of these APIs. In the docs there is a list of all the services and you can choose the one that sounds most appropriate. For example, in this case we need to use the To add a user you can call:
This pattern is consistently used throughout the SDK. If you want to affect the server, use one of the network adapter services. If you want to access the local database, use the |
Hello.
Precondition:
All Firebase setup steps are executed with no errors and firebase functions are listed on Functions page.
Problem:
pushListener function is not called when a new message is added to Realtime Database.
Observation:
running a function test using Google Cloud Platform testing UI produces an error:
TypeError: Cannot read property 'from' of null
the error is reported on this line:
const senderId = messageValue["from"];
The text was updated successfully, but these errors were encountered: