Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge develop to master #949

Merged
merged 20 commits into from
Aug 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
9920fe4
Changed Propertiest to Map for custom WebSocket Headers (502)
vit21ik Jun 19, 2018
fbf9544
Added the ability to not specify the host port during a web socket ha…
Besik13 Jun 4, 2020
6e21aa9
Fix StackOverflow in MQTTv5 when subscribing with a topicfilter, qos …
AnkurSen-github Jul 22, 2021
fb5e78e
Expose isConnected to clients to help avoid race conditions
oreillymj Sep 15, 2021
9ab015d
Fix case where Recursively calling the same method causes StackOverFlow
BaekSeungYeol Oct 14, 2021
b82a843
Fixed MQTT Con thread leak on connection failure #850
PavelAnikeichyk Apr 9, 2022
26523a1
Logic changed
PavelAnikeichyk Apr 11, 2022
009d602
Merge SSLParameters
grandfield Jun 28, 2022
a356442
Merge branch 'develop' into develop
rdasgupt Aug 6, 2022
0941287
Merge pull request #920 from PavelAnikeichyk/develop
rdasgupt Aug 6, 2022
c05461b
Merge branch 'develop' into PropertiesToMap502
rdasgupt Aug 6, 2022
188aa66
Merge pull request #555 from vit21ik/PropertiesToMap502
rdasgupt Aug 6, 2022
f12b693
Merge pull request #942 from grandfield/develop
rdasgupt Aug 6, 2022
9a315e3
Merge branch 'develop' into feature/skip_port
rdasgupt Aug 6, 2022
1e27477
Merge pull request #783 from Besik13/feature/skip_port
rdasgupt Aug 6, 2022
e6356aa
Merge pull request #894 from oreillymj/develop
rdasgupt Aug 6, 2022
6a6cd0d
Merge pull request #887 from AnkurSen-github/Fix_Recursive_call_issue
rdasgupt Aug 6, 2022
e845497
Merge pull request #899 from BaekSeungYeol/develop
rdasgupt Aug 6, 2022
0b50a84
Update maven plugin version and enable mqttv3 tests
rdasgupt Aug 6, 2022
3241085
Fix javadoc
rdasgupt Aug 6, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions MQTTv3.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ The included code below is a extended basic sample that connects to a server wit
MqttClient client = new MqttClient("wss://<BROKER_URI>", "MyClient");

MqttConnectOptions connectOptions = new MqttConnectOptions();
Properties properties = new Properties();
properties.setProperty("X-Amz-CustomAuthorizer-Name", <SOME_VALUE>);
properties.setProperty("X-Amz-CustomAuthorizer-Signature", <SOME_VALUE>);
properties.setProperty(<SOME_VALUE>, <SOME_VALUE>);
Map<String, String> properties = new HashMap<>();
properties.put("X-Amz-CustomAuthorizer-Name", <SOME_VALUE>);
properties.put("X-Amz-CustomAuthorizer-Signature", <SOME_VALUE>);
properties.put(<SOME_KEY>, <SOME_VALUE>);
connectOptions.setCustomWebSocketHeaders(properties);

client.connect(connectOptions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,16 @@ public boolean isConnected() {
return comms.isConnected();
}


/*
* (non-Javadoc)
*
* @see IMqttAsyncClient#isConnecting()
*/
public boolean isConnecting() {
return comms.isConnecting();
}

/*
* (non-Javadoc)
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,13 @@ public boolean isConnected() {
return aClient.isConnected();
}

/* (non-Javadoc)
* @see org.eclipse.paho.client.mqttv3.IMqttClient#isConnected()
*/
public boolean isConnecting() {
return aClient.isConnecting();
}

/* (non-Javadoc)
* @see org.eclipse.paho.client.mqttv3.IMqttClient#setCallback(org.eclipse.paho.client.mqttv3.MqttCallback)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/
package org.eclipse.paho.client.mqttv3;

import java.util.Map;
import java.util.Properties;

import javax.net.SocketFactory;
Expand Down Expand Up @@ -73,7 +74,8 @@ public class MqttConnectOptions {
private int mqttVersion = MQTT_VERSION_DEFAULT;
private boolean automaticReconnect = false;
private int maxReconnectDelay = 128000;
private Properties customWebSocketHeaders = null;
private boolean skipPortDuringHandshake = false;
private Map<String, String> customWebSocketHeaders = null;

// Client Operation Parameters
private int executorServiceTimeout = 1; // How long to wait in seconds when terminating the executor service.
Expand All @@ -99,7 +101,7 @@ public MqttConnectOptions() {

/**
* Returns the password to use for the connection.
*
*
* @return the password to use for the connection.
*/
public char[] getPassword() {
Expand All @@ -108,7 +110,7 @@ public char[] getPassword() {

/**
* Sets the password to use for the connection.
*
*
* @param password
* A Char Array of the password
*/
Expand All @@ -118,7 +120,7 @@ public void setPassword(char[] password) {

/**
* Returns the user name to use for the connection.
*
*
* @return the user name to use for the connection.
*/
public String getUserName() {
Expand All @@ -127,7 +129,7 @@ public String getUserName() {

/**
* Sets the user name to use for the connection.
*
*
* @param userName
* The Username as a String
*/
Expand All @@ -137,7 +139,7 @@ public void setUserName(String userName) {

/**
* Get the maximum time (in millis) to wait between reconnects
*
*
* @return Get the maximum time (in millis) to wait between reconnects
*/
public int getMaxReconnectDelay() {
Expand All @@ -146,7 +148,7 @@ public int getMaxReconnectDelay() {

/**
* Set the maximum time to wait between reconnects
*
*
* @param maxReconnectDelay
* the duration (in millis)
*/
Expand Down Expand Up @@ -206,7 +208,7 @@ private void validateWill(String dest, Object payload) {

/**
* Sets up the will information, based on the supplied parameters.
*
*
* @param topic
* the topic to send the LWT message to
* @param msg
Expand All @@ -227,7 +229,7 @@ protected void setWill(String topic, MqttMessage msg, int qos, boolean retained)

/**
* Returns the "keep alive" interval.
*
*
* @see #setKeepAliveInterval(int)
* @return the keep alive interval.
*/
Expand All @@ -237,7 +239,7 @@ public int getKeepAliveInterval() {

/**
* Returns the MQTT version.
*
*
* @see #setMqttVersion(int)
* @return the MQTT version.
*/
Expand Down Expand Up @@ -273,7 +275,7 @@ public void setKeepAliveInterval(int keepAliveInterval) throws IllegalArgumentEx
/**
* Returns the "max inflight". The max inflight limits to how many messages we
* can send without receiving acknowledgments.
*
*
* @see #setMaxInflight(int)
* @return the max inflight
*/
Expand All @@ -287,7 +289,7 @@ public int getMaxInflight() {
* <p>
* The default value is 10
* </p>
*
*
* @param maxInflight
* the number of maxInfligt messages
*/
Expand All @@ -300,7 +302,7 @@ public void setMaxInflight(int maxInflight) {

/**
* Returns the connection timeout value.
*
*
* @see #setConnectionTimeout(int)
* @return the connection timeout value.
*/
Expand All @@ -314,7 +316,7 @@ public int getConnectionTimeout() {
* the MQTT server to be established. The default timeout is 30 seconds. A value
* of 0 disables timeout processing meaning the client will wait until the
* network connection is made successfully or fails.
*
*
* @param connectionTimeout
* the timeout value, measured in seconds. It must be &gt;0;
*/
Expand All @@ -328,7 +330,7 @@ public void setConnectionTimeout(int connectionTimeout) {
/**
* Returns the socket factory that will be used when connecting, or
* <code>null</code> if one has not been set.
*
*
* @return The Socket Factory
*/
public SocketFactory getSocketFactory() {
Expand All @@ -340,7 +342,7 @@ public SocketFactory getSocketFactory() {
* apply its own policies around the creation of network sockets. If using an
* SSL connection, an <code>SSLSocketFactory</code> can be used to supply
* application-specific security settings.
*
*
* @param socketFactory
* the factory to use.
*/
Expand All @@ -350,7 +352,7 @@ public void setSocketFactory(SocketFactory socketFactory) {

/**
* Returns the topic to be used for last will and testament (LWT).
*
*
* @return the MqttTopic to use, or <code>null</code> if LWT is not set.
* @see #setWill(MqttTopic, byte[], int, boolean)
*/
Expand All @@ -362,7 +364,7 @@ public String getWillDestination() {
* Returns the message to be sent as last will and testament (LWT). The returned
* object is "read only". Calling any "setter" methods on the returned object
* will result in an <code>IllegalStateException</code> being thrown.
*
*
* @return the message to use, or <code>null</code> if LWT is not set.
*/
public MqttMessage getWillMessage() {
Expand All @@ -371,7 +373,7 @@ public MqttMessage getWillMessage() {

/**
* Returns the SSL properties for the connection.
*
*
* @return the properties for the SSL connection
*/
public Properties getSSLProperties() {
Expand Down Expand Up @@ -447,7 +449,7 @@ public Properties getSSLProperties() {
* object instead of using the default algorithm available in the platform.
* Example values: "PKIX" or "IBMJ9X509".</dd>
* </dl>
*
*
* @param props
* The SSL {@link Properties}
*/
Expand All @@ -465,7 +467,7 @@ public void setHttpsHostnameVerificationEnabled(boolean httpsHostnameVerificatio

/**
* Returns the HostnameVerifier for the SSL connection.
*
*
* @return the HostnameVerifier for the SSL connection
*/
public HostnameVerifier getSSLHostnameVerifier() {
Expand All @@ -479,7 +481,7 @@ public HostnameVerifier getSSLHostnameVerifier() {
* <p>
* There is no default HostnameVerifier
* </p>
*
*
* @param hostnameVerifier
* the {@link HostnameVerifier}
*/
Expand All @@ -490,7 +492,7 @@ public void setSSLHostnameVerifier(HostnameVerifier hostnameVerifier) {
/**
* Returns whether the client and server should remember state for the client
* across reconnects.
*
*
* @return the clean session flag
*/
public boolean isCleanSession() {
Expand All @@ -517,7 +519,7 @@ public boolean isCleanSession() {
* <li>The server will treat a subscription as non-durable
* </ul>
* </ul>
*
*
* @param cleanSession
* Set to True to enable cleanSession
*/
Expand All @@ -527,7 +529,7 @@ public void setCleanSession(boolean cleanSession) {

/**
* Return a list of serverURIs the client may connect to
*
*
* @return the serverURIs or null if not set
*/
public String[] getServerURIs() {
Expand Down Expand Up @@ -580,7 +582,7 @@ public String[] getServerURIs() {
* </p>
* </li>
* </ol>
*
*
* @param serverURIs
* to be used by the client
*/
Expand Down Expand Up @@ -615,7 +617,7 @@ public void setMqttVersion(int mqttVersion) throws IllegalArgumentException {
/**
* Returns whether the client will automatically attempt to reconnect to the
* server if the connection is lost
*
*
* @return the automatic reconnection flag.
*/
public boolean isAutomaticReconnect() {
Expand All @@ -634,14 +636,14 @@ public boolean isAutomaticReconnect() {
* double until it is at 2 minutes at which point the delay will stay at 2
* minutes.</li>
* </ul>
*
*
* @param automaticReconnect
* If set to True, Automatic Reconnect will be enabled
*/
public void setAutomaticReconnect(boolean automaticReconnect) {
this.automaticReconnect = automaticReconnect;
}

public int getExecutorServiceTimeout() {
return executorServiceTimeout;
}
Expand All @@ -650,13 +652,31 @@ public int getExecutorServiceTimeout() {
* Set the time in seconds that the executor service should wait when
* terminating before forcefully terminating. It is not recommended to change
* this value unless you are absolutely sure that you need to.
*
*
* @param executorServiceTimeout the time in seconds to wait when shutting down.Ï
*/
public void setExecutorServiceTimeout(int executorServiceTimeout) {
this.executorServiceTimeout = executorServiceTimeout;
}

/**
* Returns whether to skip a port during a handshake
*
* @return skipPortDuringHandshake
*/
public boolean isSkipPortDuringHandshake() {
return skipPortDuringHandshake;
}

/**
* Sets a flag that indicates whether to add a port to the host during a handshake
*
* @param skip if set to True, the port will not be added
*/
public void setSkipPortDuringHandshake(boolean skip) {
this.skipPortDuringHandshake = skip;
}

/**
* @return The Debug Properties
*/
Expand All @@ -679,26 +699,26 @@ public Properties getDebug() {
} else {
p.put("SSLProperties", getSSLProperties());
}
p.put("SkipPortDuringHandshake", isSkipPortDuringHandshake());
return p;
}

/**
* Sets the Custom WebSocket Headers for the WebSocket Connection.
*
* @param props
* The custom websocket headers {@link Properties}
* @param props The custom WebSocket headers
*/

public void setCustomWebSocketHeaders(Properties props) {
public void setCustomWebSocketHeaders(Map<String, String> props) {
this.customWebSocketHeaders = props;
}

public Properties getCustomWebSocketHeaders() {
public Map<String, String> getCustomWebSocketHeaders() {
return customWebSocketHeaders;
}

public String toString() {
return Debug.dumpProperties(getDebug(), "Connection options");
}

}
Loading