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.
Related
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.
I am using Ejabberd server from the source code in Linux. My situation is,if I need presence of someone then I need to add him/her in my roster and approved his/her presence request. Since I am interested in presence of a single contact at a time so it is useless for me to add lots of contacts in roster with presence approved. So I want some mechanism by which I send the presence request to someone and this request will be approved instantly by the server irrespective of the other contacts available online to approve the request or not. I am using Ejabberd 17.11 version and backend SQL for storing most of the data on the Linux Mint.
In short, Ejabberd server should automatically approve all the presence request instead of forwarding the request to the contact and wait for the approval.
As per RFC3921 https://xmpp.org/rfcs/rfc3921.html#presence, A user's server MUST NOT automatically approve subscription requests on the user's behalf. All subscription requests MUST be directed to the user's client, specifically to one or more available resources associated with the user.
I would suggest to move auto approval functionality to client side.
Hi I'm using an enhanced ejabberd named MongooseIM. I have written some articles about ejabberd on TechTalk in Chinese.
If you want to auto approval the presence, you must modify ejabberd_c2s:process_outgoing_stanzaand mod_roster:process_subscription_transaction to break the origin approval flow in MongooseIM.
I think you can do the same thing in ejabberd.
I am new in ejabberd world. Currently i am using ejabberd server for instant messaging.
My usecase
When client send roster subscription to the server then server automatically approve subscription requests on the contact's behalf if exist.
Ejabberd does not have this feature or option to automatically approve subscription requests
for this i am using these hooks
roster_in_subscription
roster_out_subscription
My problem is how to accept subscription request after getting request.
Is there any alternate solution?
plz help
This is what is mentioned in RFC 3921 present here in presence section.
Visit section 5.1.6. Responsibility to auto-accept presence requests lies with the client.
I wrote the following code in smack to auto-accept presence requests.
Roster roster = Roster.getInstanceFor(connection);
roster.setSubscriptionMode(Roster.SubscriptionMode.accept_all);
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.)
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.