Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    vhking
    @vhking
    Thanks @SeppPenner , but we are not making/using our own broker. It must be something possible from a "management/main-client" .
    I am considering to make something like a heartbeat to keep track of the state of the client in question, if there is not a better solution.
    vhking
    @vhking
    Great library btw :)
    Kerem Bilgiçer
    @setamodius
    I understand the status of clients as follows. Each client writes their 'online' message in the status/clientid topic when connecting to the broker. I also adds the 'offline' message to the same topic as willmessage. When any client uses the status/+ filter, it can see the current status of all clients.
    vhking
    @vhking
    But e.g. in a senario where the client has not yet been connected to the broker, you won't get the state that way
    vhking
    @vhking
    Otherwise i would be happy with something like that @setamodius
    Paolo Fulgoni
    @paolofulgoni
    @vhking your may check if your broker has some useful SYS topic
    for example, Mosquitto has the $SYS/clients/[client-id]/connectedtime which could be used to get the list of connected clients (using wildcard in the subscription)
    see https://github.com/mqtt/mqtt.github.io/wiki/SYS-Topics
    HansM
    @SeppPenner
    @setamodius This was the alterantive I would have suggested as well.
    @vhking Well, it's not my library, it's @chkr1011 's. I have just contributed some small parts (I wanted to do more, but don't really have time at the moment...
    @paolofulgoni Yeah, depending on the broker and the support of SYS topics (which is not in the MQTT standard as far as I know), this might work as well.
    Paolo Fulgoni
    @paolofulgoni
    btw, I think I was wrong, Mosquitto doesn't support the topic I mentioned
    the list of Mosquitto's $SYS topics is here: https://mosquitto.org/man/mosquitto-8.html (Broker Status section)
    HansM
    @SeppPenner
    @paolofulgoni Only the number of connected clients.
    vhking
    @vhking
    we ended up going with something similar to what @setamodius suggested. It should be sufficient :)
    Kuinox
    @Kuinox
    Hello there ~
    HansM
    @SeppPenner
    Hello :)
    Kuinox
    @Kuinox
    At my job we forked mqttnet, while trying to understand the whole codebase, i will anotate it with comments, you can expect a pull request adding a lot of comments soon.
    Christian
    @chkr1011
    @Kuinox Thanks for your support. What "kind" of comments do you want to add? Hopefully no "Gets or sets the ID". "Publishes a message" ones etc. :smile:
    Kuinox
    @Kuinox

    Hopefully no "Gets or sets the ID"

    I did somes of them when i was working too late in the night :p

    I will do comments on things that are not obvious or i believe is important.

    Christian
    @chkr1011
    That is perfect. Looking forward to your pull request.
    Kuinox
    @Kuinox
    For exemple: MqttTcpChannel constructors have different behavior.
    (I started to read a bit of the codebase, but i had other issues meanwhile)
    To what i can see in this class, calling the constructor with a stream implies that you should not call ConnectAsync later.
    IMO it should be at least document, or better, the constructor should be a Factory Method.
    Kuinox
    @Kuinox
    Is it normal that the CI fail a lot ? https://ci.appveyor.com/project/chkr1011/mqttnet/history
    Paolo Fulgoni
    @paolofulgoni
    @Kuinox just from curiosity, why a fork?
    Kuinox
    @Kuinox
    @paolofulgoni We wan't to use our own logger https://github.com/Invenietis/CK-ActivityMonitor
    One of my coworker will do extensive optimisations with the Spans
    We don't want to support net461 or UWP, we only need netcore.
    Kuinox
    @Kuinox
    ah, i can't edit my bad english here :p
    Christian
    @chkr1011
    @Kuinox This is not normal but we had a failing test which was not immediately fixed and thus some tests were failing. But there is still one tests which may has a race condition and may fails some times.
    Kuinox
    @Kuinox
    @chkr1011 On your AppVeyor i see something like 10-12 tests failing.
    On our AppVeyor CI, we seen one test failing multiple times, and found out the cause.
    It's a race condition that we will fix later.
    t03apt
    @t03apt
    Hi @chkr1011!
    I'd like to integrate the MQTTnet Client library to a project.
    Is there a best practice for how to handle reconnects?
    All I found is this example:
    mqttClient.UseDisconnectedHandler(async e =>
    {
        Console.WriteLine("### DISCONNECTED FROM SERVER ###");
        await Task.Delay(TimeSpan.FromSeconds(5));
    
        try
        {
            await mqttClient.ConnectAsync(options, CancellationToken.None); // Since 3.0.5 with CancellationToken
        }
        catch
        {
            Console.WriteLine("### RECONNECTING FAILED ###");
        }
    });
    Kerem Bilgiçer
    @setamodius
    Hi @t03apt you can use managedclient at MQTTnet.extensions. It handles reconnects.
    Szabolcs Siko
    @sikoszabolcs
    Hi
    Szabolcs Siko
    @sikoszabolcs
    I’m trying to send publish messages with QoS1 I’m seeing quite a bit of latency. So I’m trying to establish if there is something wrong in my code or is it because MQTTnet is always waiting for a PubAck before publishing the next item? I’m assuming that the message ordering guarantees come into play, however should that apply only on a per topic basis? Thanks.
    t03apt
    @t03apt
    @setamodius Thanks!
    Arnt Emmanuel Berge
    @ArntB
    Hi, I have been playing with the mqtt API. I have a mosquitto server. I was using standard MQTTnet and followed the examples. I switched to ManagedMqttClient because it diconnected every second. That didn't help. Stil disconnecting. Have any body experienced the same issues?
    Paolo Fulgoni
    @paolofulgoni
    No, it never happened to me. You could publish a minimal example on GitHub to reproduce your issue
    Paolo Fulgoni
    @paolofulgoni
    Hi everyone, I'm making some experiments with Blazor and MQTTnet and created a project for fun
    https://github.com/paolofulgoni/MQTTrace
    I must say that my main purpose is to learn Blazor a little bit.
    If anyone is interested, help is welcome!
    Beware: the project is really incomplete!!!
    Arnt Emmanuel Berge
    @ArntB
    I figured out what my problem was. I hade two clients with the same ClientId causing mosquitto to disconnect the clients.
    t03apt
    @t03apt
    @chkr1011, I'd like to use ManagedMqttClient with persisted sessions. I see that this PR has been merged already. Unfortunately 3.0.9-rc1 does not have it. Could you please publish an rc2 package?
    Christian
    @chkr1011
    Version 3.0.9-rc2 is now released.
    HansM
    @SeppPenner
    Version 3.0.9 is released. Just for information :)
    dF
    @mrNo0b
    Hello!
    is it possible to set TcpServer address in MqttClientOptions instead of MqttClientOptionsBuilder?
    Fichtelcoder
    @FrankenApps
    Hi, is it possible to set Username and Password on the Broker, to only allow connections with authentication?
    HansM
    @SeppPenner
    @FrankenApps Take a look at https://github.com/chkr1011/MQTTnet/wiki/Examples, please. There you can find some of my examples that contain authentication.

    @mrNo0b You can set the following options:

            public string ClientId { get; set; } = Guid.NewGuid().ToString("N");
            public bool CleanSession { get; set; } = true;
            public IMqttClientCredentials Credentials { get; set; }
            public IMqttExtendedAuthenticationExchangeHandler ExtendedAuthenticationExchangeHandler { get; set; }
            public MqttProtocolVersion ProtocolVersion { get; set; } = MqttProtocolVersion.V311;
            public IMqttClientChannelOptions ChannelOptions { get; set; }
            public TimeSpan CommunicationTimeout { get; set; } = TimeSpan.FromSeconds(10);
            public TimeSpan KeepAlivePeriod { get; set; } = TimeSpan.FromSeconds(15);
            public MqttApplicationMessage WillMessage { get; set; }
            public uint? WillDelayInterval { get; set; }
            public string AuthenticationMethod { get; set; }
            public byte[] AuthenticationData { get; set; }
            public uint? MaximumPacketSize { get; set; }
            public ushort? ReceiveMaximum { get; set; }
            public bool? RequestProblemInformation { get; set; }
            public bool? RequestResponseInformation { get; set; }
            public uint? SessionExpiryInterval { get; set; }
            public ushort? TopicAliasMaximum { get; set; }
            public List<MqttUserProperty> UserProperties { get; set; }

    So, I would say no, that's not possible.

    Fichtelcoder
    @FrankenApps

    Well, I used this

    serverOptions = new MqttServerOptionsBuilder()
                        .WithDefaultEndpoint()
                        .WithDefaultEndpointPort(mqttServer.Port)
                        .WithConnectionValidator(c =>
                        {
                            foreach (MqttUser user in mqttServer.Users)
                            {
                                if (user.Username == c.Username && user.Password == c.Password)
                                {
                                    c.ReasonCode = MqttConnectReasonCode.Success;
                                    return;
                                }
                            }
                            c.ReasonCode = MqttConnectReasonCode.BadUserNameOrPassword;
                        })
                        .WithSubscriptionInterceptor(c =>
                        {
                            c.AcceptSubscription = true;
                        })
                        .WithApplicationMessageInterceptor(c =>
                        {
                            c.AcceptPublish = true;
                        })
                        .Build();

    and it seems to work for me...
    However I honestly do not know if it is secure in any way, but it is fine for my use case.

    HansM
    @SeppPenner
    @FrankenApps If you don't mind that every user can read every topic, this should be fine :)
    deveshspraxa
    @deveshspraxa
    Anybody can help in getting client list on server on new version earlier i was able to get using GetClientSessionsStatus
    Fichtelcoder
    @FrankenApps
    https://github.com/FrankenApps/MqttDebugger
    Made a little Cross-Platform GUI in case anyone is interested. It still lacks a lot of features, but it could basically be viewed as a replacement of Arduino's Serial Monitor via MQTT.
    artistmonkey
    @artistmonkey
    Hi everyone, I'm using MqttNet in core 3.1 mvc and connect over 1000 clients and each publish around 200bytes of 7 messages every second. In MVC web, I'm using paho javascript to subscribe some topic and there was delay over and over. At first there is only 2/3 seconds and later go up to several minutes. Is there any way to set up the mqtt broker to send subscriber the last message and dump the old messages. I'd tested WithMaxPendingMessagesPerClient(3) and seem not working at all.
    amitdaalwal
    @amitdaalwal
    Hi i got docker compose with mosquitto broker, mosquitto exporter connected to grafana , prometheus. When i run docker compose up i can see by default one client is connected and some sample data is displayed in dashboard for mosquitto clients. Usually for two or three clients i login to docker mosquitto broker container and do mosquitto_subscribe to the topic manually. How to subscribe to multiple 100 clients in docker mosquitto broker. All my hubs/ clients are already publishing to the topic and mosqitto broker. If i dont subscribe to the data i dont have data in mosquittodb?. Usually a nodejs or other services consumes the topics. But as of now i dont have the setup i am looking for monitoring side. Any suggestions.
    amitdaalwal
    @amitdaalwal
    in my terminal i run for one client as mosquitto_sub -t topic -h ipaddress and then i get live data on my terminal for this one client. i am looking for one subscriber to subscribe to all 100 clients at one go. not using any application consuming it
    sander1116
    @sander1116
    Hello, can someone help me with intergration?