I'm using users.watch method to get event when new e-mail message had received, using topic pub/sub. It works fine, but, such explained in this link, the event received in responde body is historyId, but I wish get new message sent in e-mail. How I get new message using historyId? Get first element using users.messages.list with maxResults = 1 not sounds good for me, because in the short time between activated event and users.messages.list execute, if another new message arrives, the previous one will be lost because messages.list get the most recent message. How to convert historyId to messageId, and so finally use users.messages.get ?
Related
If I send a message to my own phone, it gets received properly. If I send it to my wife or son's phone, the message does not get received. Despite this, the SNS dashboard says that the messages were properly sent. I hope I'm missing something, but at this point, I don't feel like I can use SNS for customer facing apps if all the feedback I get says it worked fine, but I can't guarantee that the users actually receive a text. This is the first time I've used SNS in this way. Is this expected behavior or am I maybe missing something?
my tried wayI am trying to know when i am sending push notification to users they will open the notification or not. i am able to get the number of sent notification or number of successful and failed notification but i am unable to get the user response record.I am using aws sns push notification with fcm
it's easy!
Just put a little code in notification code, when user clicked the notification it gets the value from the database which is 0 when you start sending the notification, and add +1 in it and again store that value in the database.
This is the simple way you can check how many people open your notification.
Regards,
Sameer Rehman
I am trying to make a real-time message notification.The scenario I am having is user sends a message to user2 he gets a notification that you have a message from user2.In that inbox there are the recent 3 messages.
I wanna make it like that the inbox messages should be limited to those 3 boxes.If he gets a new message.No box should be created instead the recent message box should be rewritten with that information.If he gets 3 new messages from 3 different users.Those 3 recent message box should be updated with those messages instead of creating new boxes.Think about it like a Facebook messaging hovered inbox.I hope that makes sense.
I would suggest:
A) Persist the messages in the DB as normal records (since users might not be online when the message is sent)
B) When a message is updated/inserted send a message to the channel layer group for that user. (use the recipients id as the group name include the message-id in this event).
C) in your WebSocket consumer, you will subscribe to the group for the connected user.
D) When the event handler is triggered in your consumer I would read the message from the DB and send it to the client.
When a message is sent using sendMessage() function with a MessageDeduplicationId to prevent duplicates.
However, the sendMessage function always returns true. In other words, the sendMessage function always returns a value that says message successfully sent to SQS, however the message actually is not available.
I change a field 'sent_to_sqs' in the DB based on the sendMessage() return value.
Can anybody help me?
The design assumption is that if you send a message with the same deduplication-id, then that is the exact same message you already sent (otherwise, it should not have the same deduplication-id), so SQS pretends to accept it again, on the assumption that something must have gone wrong on your side, preventing you from realizing that the message was already submitted the first time.
“the sendMessage function always returns a value that says message successfully sent to SQS”
Yes, because it already was, earlier.
SQS doesn't verify that the message is actually a duplicate -- it assumes that it is, because you've claimed it must be by submitting the same deduplication-id within the 5 minute window. If the message has already been handled, then it will not be available on the queue, by design.
Message Deduplication ID
The token used for deduplication of sent messages. If a message with a particular message deduplication ID is sent successfully, any messages sent with the same message deduplication ID are accepted successfully but aren't delivered during the 5-minute deduplication interval.
https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html#FIFO-queues-understanding-logic
Update
Demo: http://jsbin.com/ogorab/311/edit
I'm trying to build a simple chat room that updates in realtime using Faye/Websockets. Messages are posted using regular REST, but there is also a subscription via Faye to /messages/created, which uses store.pushPayload to push the new messages.
Now the following scenario happens and I can see where it goes wrong but I have no clue how to solve it:
User submits chat message
ChatController handles the submit, calls createRecord with the chat message, and subsequently #save
The chat messages is instantly shown in the chat (triggered by createRecord). Note that no id has been assigned yet.
A REST request is send to the server
The server first publishes the message to Faye
The server responds to the REST request
Before the ajax call is resolved, a message has arrived at /messages/created
The message is again inserted in the view (it should be merged with the original message of course, but that one still hasn't been assigned an id)
The ajax call is resolved, and the id of the original message is assigned.
This results in duplicate messages, in the following order:
[message via createRecord, will resolve via ajax response]
[message inserted via pushPayload/Faye]
I hope you can understand so far. A solution would be to have Faye wait for the save call to resolve before pushing the payload. Unfortunately I don't have a reference to the record that is being saved (happens in a controller, faye subscription is set up in ApplicationRouter).
Also I would like this to work in a generic way:)
Finally found a solution for this, but other suggestions are still welcome.
Turns out that Store#didSaveRecord updates the id after the record is saved. By overriding this method (and then calling super, in that order), we can first check if a record for that id already exists:
App.Store = DS.Store.extend
didSaveRecord: (record, data) ->
# This will remove any existing records with the same id
#getById(record.constructor, data.id)?.unloadRecord()
#_super(record, data)