ClearBlade/Go-SDK — pull request #6 by fauve- (2014-12-08 22:47:18+00:00)
Title: Wrap mqtt message

@cwandrews There has been an offline request for a wrapper object around the mqtt Publish messages that should be coming off of the chan returned by a subscribe call. The reasons are
1) Messy importing by library consumers. They have to import "github.com/clearblade/mqtt_parsing", in addition to the go-sdk. Sort of breaks abstraction.
2) We require doing run time type checks to make the library useful.

What's here is basically a pipe. A goroutine sits on the channel, and unwraps the publish and sends it along to the outgoing channel.

What I don't like:
Keeping a dict of every subscription, spawning a goroutine for every subscription (in addition to goroutines layers down doing nearly identical work).

Alternatives:
Can we hoist the type from mqtt_parsing into this package? If yes, can we still use the same chan produced by the subscribe call in mqttclient? Am I having a brain-block and we can shuffle the values along without goroutines?

Impact: when this is merged, we'll have to update some internal apps.