Can we publish to multiple topics at the same time using mosquitto_pub client? - mqtt

When I try to publish to different topics using same client id it disconnects the previous connection.
It says the mosquitto_pub publishes a single message at a time so was wondering if this is a limitation.

MQTT Client Ids MUST be unique across all clients connected to the broker. The spec says the broker must disconnect any existing client when a new client with the same client id tries to connect.
The mosquitto_pub command will only publish a single message to a single topic (unless reading from a file or stdin, in which case it publishes a message per line, but again to a single topic).
If you want a single client to publish to multiple topics then you should look at one of the many MQTT client libraries and built a client that meets your needs.

Related

How to separate Test and Prod environment for WhatsApp Studio Flow?

I have bought two Twilio phone numbers which are validate and configured by Twilio and WhatsApp.
I created two Conversation Services ("Main Conversation Service" (SID:IS1234) and "Dev Conversation Service" (SID:IS4321)
Both are configured as "Engage in a discussion" Use case configuration.
Both are configured as "Autocreate a Conversation" in the Integration configuration.
Each service has a different phone number configured in the Sender Pool
Each WhatsApp Sender number Endpoint Configuration is configured a "Use Messaging Service (recomended)" with its respective Conversation Service
I have 2 Studio Flows ("WA_MAIN" and "WA_DEV"). In Flex > Manage > Messaging I have 2 WhatsApp addresses pointing each phone number to its respective Studio Flow.
This is the complete configuration, if something important is missing please ask me in the comments.
When I send a whatsapp message to each number the conversation is routed to the correct Studio Flow, but it is managed by the Main Conversation Service (IS1234), which is the older one. I have zero conversations in Dev Conversation Service (IS4321). All previous conversations with my phone number are in "closed" state.
Why is this happening? How can I build to independent environments to work with Conversations API without risking the SLA of Production environment?
This happens because of a Conversation Configuration where you configure the default messaging service that will handle the inbound conversations, you can see it on Conversations > Manager > Defaults.
The Twilio Team advises creating a new account to Homolog or Staging, so it's can be a solution to not affect your production environment.
I hope that it can help you.

How do I programmatically disconnect clients which are connected to Solace appliance?

As Solace does not support deleting and disconnecting client via SEMP over a message bus, as mentioned here, may I know how do I do that programmatically? I need to manage clients, especially client connection from my application. Can I run trigger CLI scripts from my program to achieve that?
Thank you.
Disconnecting a client is an administrative action that can only be executed by management users over the management interface. Client applications are not allowed to execute this action.
To disconnect a client, you can send a SEMP command through the management interface using a management user. (Not via SEMP over Message Bus.)

Kick or Ban user or client in Mosquitto MQTT

i have a configured Mosquitto MQTT broker...
I'd like to kick or ban a user for an amount of time?
How can i do this from another subscribed client?
Should i do this from the broker? How?
You can't block on a client id basis, the only option would be to enable ACLs with a database back end (something like https://github.com/jpmens/mosquitto-auth-plug) and then update the database to remove access to topics to specific users.

Get information clientid connect and disconnect

My project, using mosquitto is mqtt server.
I want to get the information clientid once it connects or disconnects to server. Then it will automatically send to sub default. Please help me with this issue.
Assuming you want some other client to know when a certain client connects to the broker,
When your client connects , maybe in onConnected(depends on the client library) handle you can have a specific message published with connectin info. Which the listening client can be subscribed to.
Whereas for disconnection, try the last will message. To quote mosquitto.org
Last Will and Testament
The last will and testament or just “will” is a very nice feature of MQTT. When your client connects to the MQTT broker/server, it can give the broker this will, which consists of a topic and a message. If the client is disconnected from the broker unexpectedly, that is to say without sending a disconnect message, then the broker publishes the will message on the will topic.

Amazon SNS Mobile Push - how to bulk subscribe endpoints to a topic?

I am trying to move my existing iOS push notification infrastructure over to amazon SNS mobile push.
I exported all my tokens from my local db into an SNS application (using CSV). Now I want to send push notification to all my 10,000 users. I think the only way is to create a topic and subscribe all the users to that topic then publish message to that topic.
Is there any easy way to subscribe all the 10,000 users who I have imported into the system to a topic?
Thanks for any help!
It sounds like you have created the Amazon SNS Platform Application and imported your tokens as Amazon SNS Platform Endpoints.
What kind of notification are you sending?
If you send a custom message to each user, use Direct
Addressing. With this approach, you
Publish to each EndpointARN.
If you send the same message to all users, use topics. You need to subscribe your endpoints to a topic. When you are ready to send, Publish to the TopicARN. Amazon SNS will handle delivery to all endpoints subscribed to that topic. Amazon SNS currently does not provide a bulk subscribe API, so you will have to invoke Subscribe once per EndpointARN.
Full disclosure: I work for AWS on Amazon SNS.
Unfortunately there is no way so far... see Bulk push endpoints subscription to a topic on AWS Discussion Forum.
Hi there langelvicente,
Thanks for this feature request. I've passed this back through to the SNS Service Team for review.
Best regards,
Phil P
This is now possible with subscribing mobile endpoints to topics. The default subscriber limit was increased.
Q: Are there limits to the number of topics or number of subscribers
per topic?
By default, SNS offers 10 million subscriptions per topic, and 3,000
topics per account. To request a higher limit, please contact us at
at http://aws.amazon.com/support
http://aws.amazon.com/sns/faqs/?nc2=h_ls
If you have an application full of endpoints which you want to bulk subscribe to a SNS topic you can do so from the AWS SNS dashboard by:
Going to that application in SNS
Waiting until the 'total items' count at the bottom has completed its count (ie all items are listed)
Checking the select all check mark above the list of endpoints (screenshot attached)
Tap on platform action > subscribe endpoints to topic
Enter your topic ARN and click create subscription
The process will begin and it will stall your web browser but let it be as it takes time and if you want to see the subscriptions to the topic increasing you can use the AWS CLI with :
aws sns get-topic-attributes --topic-arn "[YOUR TOPIC ARN]"
note the "SubscriptionsConfirmed" value
Yes, but caveat: they each must accept your effort to enroll them into push messaging. That means that for each token in your database, each individual must consent to receiving future messages from you (via SMS and email, that is).
Each address (tel #, email) becomes an endpoint, and you can use SNS to create a topic, then subscribe each endpoint. After a confirmation email is sent to each endpoint (person on your list), they must confirm, in order to begin receiving your stream of messages via text or email.
Unfortunately, this confirmation/consent event is dicey, and must be handled correctly. Your ARN's title must be succinct (7 letter via SMS, no subject line allowed). Hence, you must contact them via SMS using a name they will recognize (the SMS message will arrive via short code, 304-something), and can be refused and/or blocked.
Not trivial! Best to investigate using push messages via mobile app. This will avoid the coveted SMS space, but you might consider putting out a blast to email and/or SMS, in order to get them using your mobile app. Apparently, given the immediacy of SMS, folks will be reading your first confirmation within 20 seconds. This could be a good thing, if they confirm, then accept your future messages.
Am doing this right now, and am preparing to be recognized by name using my initial blast -- apps that create anonymous SMS will be banned through iTunes!

Resources