Comments (9)
If this can help, you can test the ssl connection using the test endpoint provided by Mosquitto:
mqttClient = CocoaMQTT(clientId: "clientid", host: "test.mosquitto.org", port: 8883)
mqttClient?.secureMQTT = true
mqttClient?.username = "user"
mqttClient?.password = "password"
mqttClient?.keepAlive = 90
mqttClient?.delegate = self
mqttClient?.connect()
You'll need to add this cert to your keychain.
It's also worth noting that RabbitMQ enforces the use of TLSv1.2. I had to change the dictionary provided to the startTLS
function to include these two options, sadly to no avail:
GCDAsyncSocketSSLProtocolVersionMin: 8,
GCDAsyncSocketSSLProtocolVersionMax: 8
from cocoamqtt.
After some further digging, looks like that the SSL connection is correctly established, our backend closes the connection with this error:
MQTT protocol error connect_expected for connection
Without SSL the connection works flawlessly.
from cocoamqtt.
Ok, figured it out. It's a timing issue.
I was subscribing in a completion block triggered by the didConnect
delegate. This is fine when done in plain MQTT, but not when using SSL, as you can see here:
https://github.com/emqtt/CocoaMQTT/blob/master/Source/CocoaMQTT.swift#L303
the delegate is called right away, but it should be called once the secure channel is created, in the socketDidSecure
delegate method.
from cocoamqtt.
@andreamazz thanks
from cocoamqtt.
Thanks for merging.
Are you planning a new release any time soon? I would greatly appreciate that (I'm using this as a dependency for another podspec, so I need to reference a version).
from cocoamqtt.
@andreamazz Yes, tomorrow or the day after tomorrow
from cocoamqtt.
Thanks.
from cocoamqtt.
@andreamazz , v1.0.7 released.
from cocoamqtt.
Great, thank you 👍
from cocoamqtt.
Related Issues (20)
- QOS 2 can deliver a message twice
- provide working example
- Privacy Manifest HOT 9
- publish message with 15MB of image Base64String failed. HOT 1
- TLS Support with Trusted Server Certificate HOT 5
- How can i set message expire interval?
- Retained message issue HOT 1
- "Index out of range" - error occurs when passing user properties to message
- Deployment target out of range HOT 4
- Priority Inversion Crash HOT 2
- CocoaMQTTWebSocket.swift:459:1 Type 'CocoaMQTTWebSocket.StarscreamConnection' does not conform to protocol 'WebSocketDelegate' HOT 4
- Connection issue
- Privacy Manifest HOT 3
- connecting at the same time with mqtt3 and mqtt5 to the same broker does not work HOT 4
- No userProperty info back to client in publish ack message. HOT 1
- Can't Connect CocoaMQTT connection with HiveMQ, says noAuthrized HOT 1
- no support Vision OS
- [Information] Is there a way to forcibly clear the message queue?
- Crash with latest dependency updates HOT 8
- MQTT client does not connect, disconnects after receiving 0 data from broker HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cocoamqtt.