Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/glassechidna/awsiot
https://github.com/glassechidna/awsiot
aws aws-sdk-go golang mqtt websockets
Last synced: about 23 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/glassechidna/awsiot
- Owner: glassechidna
- License: apache-2.0
- Created: 2017-11-09T21:11:00.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-11-09T21:44:57.000Z (about 7 years ago)
- Last Synced: 2024-07-16T04:22:58.985Z (6 months ago)
- Topics: aws, aws-sdk-go, golang, mqtt, websockets
- Language: Go
- Size: 4.88 KB
- Stars: 7
- Watchers: 5
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Why
The AWS SDK for Go doesn't yet support bidirectional message sending for the AWS
IoT service - see [#706][gh706], [#820][gh820], [#1304][gh1304]. As such, I created
a _tiny_ library to fill the gap (at least as far as my needs extended) until AWS
provides this support.[gh706]: https://github.com/aws/aws-sdk-go/issues/706
[gh820]: https://github.com/aws/aws-sdk-go/issues/820
[gh1304]: https://github.com/aws/aws-sdk-go/issues/1304## How
This library's usage is modelled on how AWS API clients are used in the official
library. It should feel familiar to developers who have used those before. It
returns a URL string, which can be used to initialise a client in the
`eclipse/paho.mqtt.golang` MQTT library.```go
package mainimport (
MQTT "github.com/eclipse/paho.mqtt.golang"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/aws/credentials/stscreds"
"github.com/glassechidna/awsiot"
)func main() {
sessOpts := session.Options{
SharedConfigState: session.SharedConfigEnable,
AssumeRoleTokenProvider: stscreds.StdinTokenProvider,
}sess := session.Must(session.NewSessionWithOptions(sessOpts))
iot := awsiot.New(sess)
theUrl, _ := iot.WebsocketUrl("a1kxjqeyezkt7")opts := MQTT.NewClientOptions().AddBroker(theUrl)
opts.SetClientID("clientid")
client := MQTT.NewClient(opts)
}
```