Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
flightonary committed Jan 11, 2015
1 parent f05bdbb commit e20fb92
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ $ git submodule update

Usage
-----
Here is a basic sample.
```swift
import Moscapsule

Expand All @@ -46,6 +47,25 @@ mqttClient.subscribe("subscribe/topic", qos: 2)
mqttClient.disconnect()
```

The framework supports TLS_PSK, Server and/or Client certification.
Here is a server certificate sample.
```swift
import Moscapsule

// Note that you must initialize framework only once after launch application
// in case that it uses SSL/TLS functions.
moscapsule_init()

let mqttConfig = MQTTConfig(clientId: "server_cert_test", host: "test.mosquitto.org", port: 8883, keepAlive: 60)

let bundlePath = NSBundle(forClass: self.dynamicType).bundlePath.stringByAppendingPathComponent("cert.bundle")
let certFile = bundlePath.stringByAppendingPathComponent("mosquitto.org.crt")

mqttConfig.mqttServerCert = MQTTServerCert(cafile: certFile, capath: nil)

let mqttClient = MQTT.newConnection(mqttConfig)
```

License
-------
The MIT License (MIT)
Expand Down

0 comments on commit e20fb92

Please sign in to comment.