The "deleteMqSession" action selects an MQ session by the "clientName" property and either sets its "sessionStatus" to "inactive" or permanently removes it.
- To permanently delete a session, you must set the
"permanentlyDeleteSession"property totrue. - To deactivate a session, set the
"permanentlyDeleteSession"property tofalseornullor omit the property.
Permanently deleting a session is useful for removing temporary client connections create during testing and troubleshooting and for resetting client sessions so that a device or software can reconnect in the future to recreate the session from scratch.
Deactivating a session is useful for labelling a session as inactive without preventing a device or software form connecting to that session in the future. The server preserves the data for an inactive session so it can continue to associate the session with the messages it previously sent and received.
The action returns an error when a session with the specified "clientName" does not exist or the action fails.
If an MQTT session with the specified "clientName" is connected, this action disconnects it. An MQTT client will typically reconnect after it is disconnected, which automatically recreates the session using the client's session parameters. Thus, you can permanently delete a session to force it to be recreated by the client from scratch. You can also inactivate a session to temporarily disconnect an MQTT client. If the client reconnects, the server sets the "sessionStatus" to "normal". If the client does not reconnect, the "sessionStatus" remains "inactive", which signals that no device or software is using the session.
If you want to prevent any device or software from connecting to an MQ session, use the "alterMqSession" action to set the "sessionStatus" to "banned". The server returns an error for each connection attempt to that session.
Request examples
Minimum
{
"action": "deleteMqSession",
"params":
{
"clientName": "a unique MQTT or MQ API client identifier",
"permanentlyDeleteSession": true
},
"authToken": "replaceWithAuthTokenFromCreateSession"
}Maximum
{
"api": "mq",
"action": "deleteMqSession",
"params":
{
"clientName": "a unique MQTT or MQ API client identifier",
},
"apiVersion": "1.0",
"debug": "max",
"requestId": "optionalUniqueRequestIdFromTheClient",
"authToken": "replaceWithAuthTokenFromCreateSession"
}
Response example
Typical
{
"authToken": "replaceWithAuthTokenFromCreateSession",
"result": {},
"requestId": "00000004",
}
Properties
Request properties ("params")
| Property | Description | Default | Type | Limits (inclusive) |
|---|---|---|---|---|
clientName |
The "clientName" property specifies the unique name that identifies the client to the FairCom MQ engine. |
Optional with default of ""
|
string | 0 to 65,550 bytes |