Skip to content

Commit

Permalink
Merge pull request #2 from floitsch/floitsch/update_mqtt
Browse files Browse the repository at this point in the history
Update to the latest version of the mqtt package.
  • Loading branch information
Kasper Lund authored Jun 28, 2022
2 parents 32ac226 + 6ee4e21 commit c7e56d2
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
8 changes: 4 additions & 4 deletions examples/package.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ packages:
mqtt: mqtt
mqtt:
url: github.com/toitware/mqtt
version: 1.1.2
hash: 7ff2620c895960b2c31990dd06107729bb03b94b
version: 2.0.1
hash: b96f1ca3ced9cf30934acc2c7911f1ea92d3bb71
toit-cert-roots:
url: github.com/toitware/toit-cert-roots
version: 1.0.0
hash: bc4e7a2382dc5accb9c6c59673a4292e2f3a5698
version: 1.3.2
hash: 288547039d8a3797330064e91d8c79ad16313545
8 changes: 4 additions & 4 deletions package.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ prefixes:
packages:
mqtt:
url: github.com/toitware/mqtt
version: 1.1.2
hash: 7ff2620c895960b2c31990dd06107729bb03b94b
version: 2.0.1
hash: b96f1ca3ced9cf30934acc2c7911f1ea92d3bb71
toit-cert-roots:
url: github.com/toitware/toit-cert-roots
version: 1.0.0
hash: bc4e7a2382dc5accb9c6c59673a4292e2f3a5698
version: 1.3.2
hash: 288547039d8a3797330064e91d8c79ad16313545
4 changes: 2 additions & 2 deletions package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: qubitro
dependencies:
certificate_roots:
url: github.com/toitware/toit-cert-roots
version: ^1.0.0
version: ^1.3.2
mqtt:
url: github.com/toitware/mqtt
version: ^1.1.2
version: ^2.0.1
16 changes: 8 additions & 8 deletions src/connect.toit
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ Connects to the Qubitro MQTT broker. If no $network is provided, the default
*/
connect --id/string --token/string --network/net.Interface?=null -> Client:
if not network: network = net.open
socket := network.tcp_connect QUBITRO_HOST QUBITRO_PORT

tls_socket := tls.Socket.client socket
transport := mqtt.TcpTransport.tls network --host=QUBITRO_HOST --port=QUBITRO_PORT
--root_certificates=[certificate_roots.BALTIMORE_CYBERTRUST_ROOT]
tls_socket.handshake

mqtt_client := mqtt.Client
id
mqtt.TcpTransport tls_socket
--username=id
--password=token
options := mqtt.SessionOptions
--client_id=id
--username=id
--password=token

mqtt_client := mqtt.Client --transport=transport
mqtt_client.start --options=options

return Client id mqtt_client

0 comments on commit c7e56d2

Please sign in to comment.