[squeak-dev] MQTT for Squeak?

Eliot Miranda eliot.miranda at gmail.com
Fri Feb 2 16:10:43 UTC 2018



> On Feb 1, 2018, at 6:22 PM, David T. Lewis <lewis at mail.msen.com> wrote:
> 
>> On Thu, Feb 01, 2018 at 05:08:48PM -0800, tim Rowledge wrote:
>> 
>> 
>>> On 01-02-2018, at 5:02 PM, David T. Lewis <lewis at mail.msen.com> wrote:
>>> 
>>> On Thu, Feb 01, 2018 at 03:02:45PM -0800, tim Rowledge wrote:
>>>> More improvements to MQTTClient; thanks to John we caught an issue with QOS 2 publishing. And discovered that the mosquitto broker will actually pass on invalid UTF-8 topic strings (really - a single byte 192 was sent by someone on the test.mosquitto.org open broker), so we had to cope with such nonsense.
>>>> 
>>>> Version 23 on squeaksource.com/MQTTClient and listed in SqueakMap.
>>>> 
>>> 
>>> Thanks for the update. It looks like the unit tests require a running broker
>>> on host amtiskaw, is there a way that we might mock this out or similate it
>>> in the image?  I suspect that a real broker would be a non-trivial thing to
>>> implement but some kind of fake broker to support the unit tests might not
>>> be too bad.
>> 
>> Hmm, a good point that I hadn???t thought to address. Logically speaking it ought to be possible to connect instead to test.mosquitto.org or some other public broker. The problem then becomes making the broker send the appropriate packets, something I think I simply cheated on during initial testing. By installing the mosquitto package on my mac mini I also got a commandline client that I could use to trigger actions. Doing this right will probably involve some Actual Thinking. Oh dear...
>> 
> 
> We are talking about test driven development here. No actual thinking
> required, trust me I read it in a book  ;-)
> 
> But to be serious, you already have MQTTPacket>>encodeOn: for sending, and
> you have MQTTPacket class>>readFrom: for receiving. These do not require
> any external connections or sockets, so any kind of fake "server" that
> can respond by writing things like MQTTPacketConnAck over a stream should
> be sufficient to support stand-alone unit tests.
> 
> As far as figuring out the appropriate packets, cheating is absolutely the
> right thing to do. Figure it out with a real mosquitto server, then cut-n-paste
> into your fake one to do the same thing. Works a champ, I've done it a lot.

+1

> 
> I have to admit that getting a fake server sorted out can be a pain, but
> it's worth a bit of extra effort because once you get it working it works
> forever without any apt-get or sudo or unix-foo annoyances.

The cost benefit ratio is high.  No pain, no gain ;-)

> 
> Dave 
> 


More information about the Squeak-dev mailing list