markallanson / nmqtt Goto Github PK
View Code? Open in Web Editor NEWAn implementation of the MQTT v3 protocol on the .Net and Mono platforms.
Home Page: http://wiki.github.com/markallanson/nmqtt
License: MIT License
An implementation of the MQTT v3 protocol on the .Net and Mono platforms.
Home Page: http://wiki.github.com/markallanson/nmqtt
License: MIT License
I admit that i'm quite new to Xamarin and developing in C# in general. But it seems like impossible for me to build this library. I've had my teacher look at it as well, and we couldn't figure it out. Maybe there's a known issue? :)
This is the error I get:
/Users/path/nmqtt/.nuget/nuget.targets: Error: Command 'mono --runtime=v4.0.30319 /Users/path/nmqtt/.nuget/NuGet.exe install "packages.config" -source "" -RequireConsent -solutionDir "/Users/path/nmqtt/"' exited with code: 2. (nMQTT)
(replaced original path with path for overview purpose)
Thanks in advance, bobby
Currently we handle strings as ASCII only, which works most of the time, but won't work if anyone ever uses utf8 in a message, topic or any other string field, all of which are supposed to support utf8
1.in MessageLogger.cs:
it's better to use a Property or Parameter to replace Settings.Default.EnableMessageLogging, otherwise it cann't be used in webapi
2.when dispose the client after PublishMessage immediately, it will throw an exception that nullobject reference, maybe need a strategy wait for the ReadHeaderComple complete.
Currently there are a number of potential reasons a connection may not be acknowledged by a broker. We need to expose these failures to callers of the Connect
method on the MqttClient
class.
The current implementation uses callbacks to notify a consumer when a message that matches what they asked for is available. This doesn't play nicely with QOS level 1 and 2 subscriptions, or when the connect-clean flag is not set upon connection (ie persisted subscriptions) because the client would have to somehow re-hook the callbacks when re-establishing the connections.
Switching to using events would cause a level of indirection on client consumers with the benefit of a simpler, more understandable API.
Messages are read from a socket synchronously in a single read. When the expected message size is large, Read will return less bytes than requested.
The incomplete message is then parsed and the client crashes.
Repeat reads from the socket until the complete message has been received.
Hi, I'm using QOS ExactlyOnce. Is this supported as I notice you have an issue below. Basically when I use this the code below throws an error. It is because the GetNextMessageIdentifier returns a count only unique per topic. The id is then added to publishedMessages dictionary which contains all sent messages. Therefore I send a message to topic A and then to topic B, both will be given ID 1 and the dictionary add fails as the key already exists. Am I doing something wrong?
public short Publish(string topic, MqttQos qualityOfService, object data)
where TDataConverter : IPublishDataConverter
{
short msgID = MessageIdentifierDispenser.GetNextMessageIdentifier(String.Format("Topic:{0}", topic));
IPublishDataConverter converter = GetPublishDataConverter<TDataConverter>();
MqttPublishMessage msg = new MqttPublishMessage()
.ToTopic(topic)
.WithMessageIdentifier(msgID)
.WithQos(qualityOfService)
.PublishData(converter.ConvertToBytes(data));
// QOS level 1 or 2 messages need to be saved so we can do the ack processes
if (qualityOfService == MqttQos.AtLeastOnce || qualityOfService == MqttQos.ExactlyOnce)
{
Console.WriteLine("{0}",System.Threading.Thread.CurrentThread.ManagedThreadId);
publishedMessages.Add(msgID, msg);
}
connectionHandler.SendMessage(msg);
return msgID;
}
I fixed this by adding the following unpleasant hack at the start of function MessageIdentifierDispenser.GetNextMessageIdentifier:
key = "All";
Thereby ensuring that all messages are counted consecutively regardless of topic
Topic subscriptions have semantics which can contain wildcards, such as:
finance/stocks/ibm/#
which would allow matching of topics such as:
finance/stocks/ibm/live
finance/stocks/ibm/eod
We need to support subscriptions of this nature along with the other cases that are mentioned in Appendix A of the MQTT spec.
Currently an MqttClient is single use - meaning you need to dispose and create a new one to reconnect. It would be useful to be able to pull the connection up and down and have subscriptions re-sync without having to do these cleanups.
Internally it uses a short not a ushort therefore returns negatives over 32k.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.