Skip to content

Commit 42860bc

Browse files
committed
update latest MQTT-Client-Framework
1 parent c0f3f23 commit 42860bc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+725
-4681
lines changed

ios/RCTMqtt/Mqtt.m

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
//
55
// Created by Tuan PM on 2/13/16.
66
// Copyright © 2016 Tuan PM. All rights reserved.
7+
// Updated by NaviOcean on 01/04/18
78
//
89

910
#import "Mqtt.h"
@@ -45,6 +46,8 @@ - (id)init {
4546

4647
}
4748

49+
50+
4851
return self;
4952
}
5053

@@ -58,13 +61,15 @@ - (instancetype) initWithEmitter:(RCTEventEmitter *) emitter
5861
for (NSString *key in options.keyEnumerator) { // Replace default options
5962
[self.options setValue:options[key] forKey:key];
6063
}
61-
self.manager = [[MQTTSessionManager alloc] init];
62-
self.manager.delegate = self;
64+
65+
66+
6367

6468
return self;
6569
}
6670

6771
- (void) connect {
72+
6873
MQTTSSLSecurityPolicy *securityPolicy = nil;
6974
if(self.options[@"tls"]) {
7075
securityPolicy = [MQTTSSLSecurityPolicy policyWithPinningMode:MQTTSSLPinningModeNone];
@@ -75,7 +80,11 @@ - (void) connect {
7580
if(self.options[@"willMsg"] != [NSNull null]) {
7681
willMsg = [self.options[@"willMsg"] dataUsingEncoding:NSUTF8StringEncoding];
7782
}
78-
[[NSOperationQueue mainQueue] addOperationWithBlock:^{
83+
if (!self.manager) {
84+
dispatch_queue_t queue1 = dispatch_queue_create("com.hawking.app.anchor.mqtt", NULL);
85+
self.manager = [[MQTTSessionManager alloc] initWithPersistence:NO maxWindowSize:MQTT_MAX_WINDOW_SIZE maxMessages:MQTT_MAX_MESSAGES maxSize:MQTT_MAX_SIZE maxConnectionRetryInterval:60.0 connectInForeground:NO streamSSLLevel:nil queue: queue1];
86+
self.manager.delegate = self;
87+
7988
[self.manager connectTo:[self.options valueForKey:@"host"]
8089
port:[self.options[@"port"] intValue]
8190
tls:[self.options[@"tls"] boolValue]
@@ -92,8 +101,15 @@ - (void) connect {
92101
withClientId:[self.options valueForKey:@"clientId"]
93102
securityPolicy:securityPolicy
94103
certificates:nil
95-
];
96-
}];
104+
protocolLevel:MQTTProtocolVersion311
105+
connectHandler:^(NSError *error) {
106+
}];
107+
108+
} else {
109+
[self.manager connectToLast:^(NSError *error) {
110+
}];
111+
}
112+
97113
}
98114

99115
- (void)sessionManager:(MQTTSessionManager *)sessonManager didChangeState:(MQTTSessionManagerState)newState {
@@ -153,7 +169,8 @@ - (void)messageDelivered:(UInt16)msgID {
153169
- (void) disconnect {
154170
// [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1.0]];
155171
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1.0]];
156-
[self.manager disconnect];
172+
[self.manager disconnectWithDisconnectHandler:^(NSError *error) {
173+
}];
157174

158175
}
159176

@@ -194,4 +211,4 @@ - (void)dealloc
194211
[self disconnect];
195212
}
196213

197-
@end
214+
@end

ios/RCTMqtt/Podfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ platform :ios, '8.0'
22

33
inhibit_all_warnings!
44

5-
pod 'MQTTClient/Min', '0.10.2'
6-
pod 'MQTTClient/Manager', '0.10.2'
7-
pod 'MQTTClient/Websocket', '0.10.2'
5+
pod 'MQTTClient'
86

97
target "RCTMqtt" do
108
end

ios/RCTMqtt/Podfile.lock

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,23 @@
11
PODS:
2-
- MQTTClient/Manager (0.10.2):
2+
- MQTTClient (0.15.2):
3+
- MQTTClient/Core (= 0.15.2)
4+
- MQTTClient/Core (0.15.2):
5+
- MQTTClient/Manager
36
- MQTTClient/Min
4-
- MQTTClient/Min (0.10.2)
5-
- MQTTClient/Websocket (0.10.2):
7+
- MQTTClient/Manager (0.15.2):
68
- MQTTClient/Min
7-
- SocketRocket
8-
- SocketRocket (0.5.1)
9+
- MQTTClient/Min (0.15.2)
910

1011
DEPENDENCIES:
11-
- MQTTClient/Manager (= 0.10.2)
12-
- MQTTClient/Min (= 0.10.2)
13-
- MQTTClient/Websocket (= 0.10.2)
12+
- MQTTClient
1413

1514
SPEC REPOS:
1615
https://github.com/cocoapods/specs.git:
1716
- MQTTClient
18-
- SocketRocket
1917

2018
SPEC CHECKSUMS:
21-
MQTTClient: e8d3d642f28548296511b3af4e2cef12874071ce
22-
SocketRocket: d57c7159b83c3c6655745cd15302aa24b6bae531
19+
MQTTClient: 902c7bcac1501595f3d0b15178c7205b40331fb0
2320

24-
PODFILE CHECKSUM: 8a78d953ebebde4bab733da71043c420ecbd75cd
21+
PODFILE CHECKSUM: e61f0901f7eb0b464089f1f9f5d404df37195e34
2522

2623
COCOAPODS: 1.5.3

ios/RCTMqtt/Pods/Headers/Private/MQTTClient/MQTTWebsocketTransport.h

Lines changed: 0 additions & 1 deletion
This file was deleted.

ios/RCTMqtt/Pods/Headers/Private/SocketRocket/SRWebSocket.h

Lines changed: 0 additions & 1 deletion
This file was deleted.

ios/RCTMqtt/Pods/Headers/Private/SocketRocket/SocketRocket.h

Lines changed: 0 additions & 1 deletion
This file was deleted.

ios/RCTMqtt/Pods/Headers/Public/MQTTClient/MQTTWebsocketTransport.h

Lines changed: 0 additions & 1 deletion
This file was deleted.

ios/RCTMqtt/Pods/Headers/Public/SocketRocket/SRWebSocket.h

Lines changed: 0 additions & 1 deletion
This file was deleted.

ios/RCTMqtt/Pods/Headers/Public/SocketRocket/SocketRocket.h

Lines changed: 0 additions & 1 deletion
This file was deleted.

ios/RCTMqtt/Pods/MQTTClient/MQTTClient/MQTTClient/ForegroundReconnection.m

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ios/RCTMqtt/Pods/MQTTClient/MQTTClient/MQTTClient/MQTTCFSocketDecoder.h

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ios/RCTMqtt/Pods/MQTTClient/MQTTClient/MQTTClient/MQTTCFSocketDecoder.m

Lines changed: 5 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ios/RCTMqtt/Pods/MQTTClient/MQTTClient/MQTTClient/MQTTCFSocketEncoder.h

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ios/RCTMqtt/Pods/MQTTClient/MQTTClient/MQTTClient/MQTTCFSocketEncoder.m

Lines changed: 7 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ios/RCTMqtt/Pods/MQTTClient/MQTTClient/MQTTClient/MQTTCFSocketTransport.h

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)