can I send a request via publish subscriber model - communication

My question is related to pub and sub communication model. Specifically, can I send a request via this system. for example, If I'm the publisher, can I send a request to the subscribers saying I need more information about your system or some information about a specific thing. what i know that I can only publish data, but I do not know if I can send a request.

Yes, you can, the question is how correct is the use of the protocol for that..
Your client can pub a topic home/xoce/readyToGetInfo/ true and maybe all other clients subscribed to that topic can readdct to that and begin to push
home/xoce/temperature/ 11.11
but it looks very weird...

Related

Is there a way to send a conversation unique identifier to the Twilio webhook?

I'm trying to figure out if there is a way to uniquely identify the conversation an SMS is replying to without having to buy a new 'from' phone number each time. I know that one can store whatever you want in cookie or session storage, but those both expire in different ways. What I really want is somehow to pass or use an existing unique id for each separate conversation. So that I can map the messages to the right conversations.
I'm not sure but I wonder if its possible to send a expireless unique identifier to a webhook. So that I know which conversation it should be mapped to?
If not is there some way to use the conversation api to achieve the effect of tracking which sms messages belong to which conversations?
A common challenge, since SMS is a stateless, is to try and match up the specific request with the response. Twilio Studio's Send and Wait for Reply widget does this by only allowing one sent message (to the destination number) until there is a response OR the configurable timeout parameter expires, and then moving to the next widget, so keeping state of the interaction.
As you said, if you are attempting to have multiple simultaneous threads to the same destination phone number, you will need to use a unique From number to separate out the threads - from the received parties perspective, they don't see threading in their SMS client, and cannot pick which question to respond to.
Best Practices for SMS Message Logging
Additional Questions Q: Can a user send a customer identifier for a
message, or is only the Twilio-defined SID available?
A: Only the Twilio-defined SID is available.

Showing Read At for Twilio Programmable chat

I'm using Programmable chat. I'm trying to show ReadAt meta data to users. I know when the user is getting the message on the frontend since I'm listening to messageAdded on the current Channel in the Twilio Javascript SDK. I'm storing the message by listening to Webhook on the preMessageSend to make sure that the message is saved in DB. When I get this message, the problem is I'm not getting the messageId which I'm getting on the Javascript SDK message. Can someone help me in understanding how to correlate both the messages?
According to the Twilio developer docs:
Pre-Event Webhooks will fire before an action has been committed to the Chat instance, blocking publication until a response is received. This gives your backend (or Function) the opportunity to intercept, modify, or reject any action across the instance, making these hooks useful for spam/language filtering, complex permission schemes, or other business logic. Pre-event webhooks are fired only for actions from the Chat SDK; the REST API actions will never fire them.
So I suspect the messageId is not created until after this webhook.

Mobile Chat application on Google App Engine and Socket.IO

I am creating a chat application with Node.JS's Socket.IO and there is a couple things I need clarification on.
I am implementing offline messaging in my app meaning that when a user opens the app he will receive all the messages he missed when they were online.
This is my approach:
1) Client opens the app and is subscribed/joins a room
2) The client sends a message to Socket.IO
3) Socket.IO inserts the message in some kind of database/datastore
4) When client tries to retrieve the messages it is pulled from the database/datastore and saved on the users phone then it is deleted from the database.
Is this a correct approach?
I was looking at online and some people suggested using task/message queues like Google App Engines Task Queue but I am not sure how this works.
Your approach sounds OK, but I wouldn't delete messages from a DB, at least not immediately after the client receives them.
From your question it seems that you're not currently saving the messages to a database.
This approach has some drawbacks; for example, the user can't view their chat history on a device that was not connected when some of the messages were sent.
There are 2 ways I can think of to do it in a more elegant manner:
Save all messages to DB. on websocket connection and reconnections, fetch all messages newer than your latest message (This approach assumes no edit functionality in your chat, as edits will not be fetched this way). The latter can be implemented using either HTTP or WebSockets.
If you don't want to store the messages in your server, then you should implement some sort of persistent cache in the device used to send the messages. This is very similar to your original solution, except that instead of storing the messages in a database, you're storing them on the user's device. this does require some logic to detect when messages are received, and when the recipient reconnects, in order to trigger sending the missing messages.
The first approach is much better for the general use case in my opinion, but it depends on your use case.

CloudKit/Firebase: is it possible to send not only push when a record changes but also mail?

In my app I do need synchronization/communication between devices, therefore I need a serverside database. Whenever some special record changes, I need to send a push notification and/or an email.
It's an iOS-only app, so Cloudkit would be fine, but I don't think that it's possible to send an e-mail. Same fore Firebase. Am I overlooking something or are there very similar alternatives which are capable of both, sending push and mail?
Since March 2017 there's an integration between Google Cloud Functions and Firebase. This allows you to run JavaScript code on Google's servers in response to events that happen in Firebase. A node being written to the database is one such event, but there are many more use-cases.
Your use-case seems closest to this sample, which sends a welcome email when a user subscribes to some fictional newsletter.

How to use the comment update service in iOS?

I have created an app in objective C, In this app i have one page there User can comment live and for the updating comments i am hitting every 5 min the web-service. I have no idea about the server data change .
I want to hit the service while the data has been change to the server.
Is it possible . Or we can use some other way for the web services.
Thanks, Please answer if you have an correct way to solve it.
Go to this web site PubNub, download SDK's for both Server and Objective-C. PubNub is a common Stream Service with Subscribe/Publish services. After implementing SDK's, make your Client as Subscriber, and make your Server as Publisher. Simply; Subscribers are listening channels for data. When you have a new comment, Publish that comment from Server to channel which your client has already subscribed. Do not forget, free accounts are for demo purposes and have limitations.

Resources