Skip to content
An implementation of a MQTT Client and a Broker in pure Smalltalk for Pharo
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Documents
.properties
Boolean.extension.st
LICENSE
MQTTBadHeaderException.class.st
MQTTBadPacketTestConnect.class.st
MQTTBadPacketTestTestBadMsgIDConnect.class.st
MQTTBadPacketTypeException.class.st
MQTTBadTopicException.class.st
MQTTBrokerLookupFailure.class.st
MQTTCONNECTException.class.st
MQTTClientIDHolder.class.st
MQTTClientInterface.class.st
MQTTConnectionException.class.st
MQTTEmptyStreamErrorException.class.st
MQTTPacket.class.st
MQTTPacketAndPendingJobPair.class.st
MQTTPacketConnAck.class.st
MQTTPacketConnect.class.st
MQTTPacketDisconnect.class.st
MQTTPacketPingReq.class.st
MQTTPacketPingResp.class.st
MQTTPacketPubAck.class.st
MQTTPacketPubComp.class.st
MQTTPacketPubRec.class.st
MQTTPacketPubRel.class.st
MQTTPacketPublish.class.st
MQTTPacketSubAck.class.st
MQTTPacketSubscribe.class.st
MQTTPacketUnsubAck.class.st
MQTTPacketUnsubscribe.class.st
MQTTPacketVariableHeaded.class.st
MQTTPacketVariableHeadedWithPayload.class.st
MQTTPendingJob.class.st
MQTTPendingPingJob.class.st
MQTTPendingPubAckJob.class.st
MQTTPendingPubCompJob.class.st
MQTTPendingPubRecJob.class.st
MQTTPendingPubRelJob.class.st
MQTTPendingSubAckJob.class.st
MQTTPendingUnsubAckJob.class.st
MQTTServerInterface.class.st
MQTTSocketClient.class.st
MQTTSocketDaemon.class.st
MQTTSocketServer.class.st
MQTTStatistics.class.st
MQTTSubscription.class.st
MQTTTransportLayer.class.st
MQTTTransportLayerClient.class.st
MQTTTransportLayerServer.class.st
MQTTWriteStream.class.st
Object.extension.st
README.md
Socket.extension.st
UTF8Encoder.class.st
package.st

README.md

MQTT-broker

An implementation of a MQTT Client and a Broker in pure Smalltalk for Pharo

This work is based on the work that Tim Rowledge wrote for the Pi The original code base is found at:

http://www.squeaksource.com/MQTTClient.html

What we did was refactor the logic into a client and server interface to support a full MQTT V311 data broker in pure Smalltalk. This product (in VSE) did pass various V311 data broker test units, after converting to Pharo we hope it still works.

To start the server. (MQTTServerInterface openOnPort: 1883) start inspect.

To start a client.
[(MQTTClientInterface openOnHostName: ‘192.168.1.139’ port: 1883 keepAlive: 300) start inspect] fork.
or
[(MQTTClientInterface openOnHostName: ‘test.mosquitto.org’ port: 1883 keepAlive: 300) start inspect] fork.

Stopping the server or the client.

MQTTServerInterface  allInstances do: [ :e | e stop ].
MQTTClientInterface  allInstances do: [ :e | e stop ].

Helpful for figuring out what is running, or not, ensure you do a GC before using.

MQTTSocketClient  allInstances  inspect.
MQTTClientInterface allInstances  inspect.
MQTTTransportLayerClient allInstances  inspect.
MQTTSocketServer  allInstances  inspect.
MQTTServerInterface allInstances inspect.
MQTTSocketDaemon allInstances inspect.
MQTTTransportLayerServer allInstances inspect.

If you examine the class MQTTStatistics we do collect statistics on each server and client session.

LOGGING is on To turn it off change the code found in MQTTCLientInterface class>>debugLog:tag:str2: (or: [true])

In MQTTCLientInterface there are methods testBlock and testSetupForTopic These can be alter to test for example a connection to test.mosquitto.org. At the moment they send QOS > 0 message info to the Transcript

Things that the community could do?

Persistent store of the data broker queued data
Ensure it works with Pharo
Port to VA Smalltalk
Port to other variations. 
Respecting userid & password in the Connect packet.
If you need a VSE version please contact us. 
You can’t perform that action at this time.