implementation of generation of client id in mqtt client

99 views
Skip to first unread message

kushal bhattacharya

unread,
Nov 20, 2016, 7:13:14 AM11/20/16
to MQTT
hi,
I am totally following what hivemq and mqtt specs are telling.But i have confusion regarding their implementation.In mqtt specs they are suggesing to generate random client id if cleansession flag is true and  not for cleansession flag being false.My question is how do i really implement this on my area of programming language.To be more specific am working in linux command line and my programming language is c++.
Message has been deleted

kushal bhattacharya

unread,
Nov 20, 2016, 7:20:38 AM11/20/16
to MQTT
i have implemented both of them separately in different scenarios.First taking client id from command line and then in my next update i am generating unique random client id.Now i am trying to combine both of my ideas according to the state of cleansession.I am not able to discover nice ideas about implementing both of them,
Thanks,

Paul Fremantle

unread,
Nov 20, 2016, 8:57:50 AM11/20/16
to mq...@googlegroups.com
Kushal

I think you'd do better to ask this on a C++ coding or Linux forum as this is really a coding question.

Paul

On 20 November 2016 at 12:20, kushal bhattacharya <bhattachar...@gmail.com> wrote:
i have implemented both of them separately in different scenarios.First taking client id from command line and then in my next update i am generating unique random client id.Now i am trying to combine both of my ideas according to the state of cleansession.I am not able to discover nice ideas about implementing both of them,
Thanks,

--
To learn more about MQTT please visit http://mqtt.org
---
You received this message because you are subscribed to the Google Groups "MQTT" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mqtt+unsubscribe@googlegroups.com.
To post to this group, send email to mq...@googlegroups.com.
Visit this group at https://groups.google.com/group/mqtt.
For more options, visit https://groups.google.com/d/optout.



--
Paul Fremantle
Doctoral Researcher, University of Portsmouth, School of Computing
Visiting Scientist, Institute of the Architecture of Application Systems, Stuttgart
Visiting Lecturer, Software Engineering Programme, Oxford University
Co-Founder, WSO2
Apache Member and Committer
twitter: pzfreo / skype: paulfremantle / blog: http://pzf.fremantle.org

Nicholas O'Leary

unread,
Nov 20, 2016, 9:02:19 AM11/20/16
to mq...@googlegroups.com
Kushal,

just to be clear, you're now asking about the client implementation rather than a server implementation?

Is there a reason why you cannot use one of the existing open-source MQTT client implementations such as Eclipse Paho? They handle the details of the protocol in a tried and tested way - and will allow you to focus on your application.

NIck

On 20 November 2016 at 13:57, Paul Fremantle <paul.fr...@port.ac.uk> wrote:
Kushal

I think you'd do better to ask this on a C++ coding or Linux forum as this is really a coding question.

Paul

kushal bhattacharya

unread,
Nov 21, 2016, 11:45:21 PM11/21/16
to MQTT
actually my company requires me to build own pewrsonalised mqtt client and broker i had to make all of the implementations from scratch and thus these are the stuffs which are creating some confusions

Paul Fremantle

unread,
Nov 22, 2016, 1:40:23 AM11/22/16
to mq...@googlegroups.com
Kushal

I'm sure you are doing this, but - having been involved in lots of interop protocols before I'll just stress it:

Anyone building a new client and server implementation should make sure they test each side with lots of other systems. 
So trying their new MQTT client with Mosquitto, Hive, Aedes, Moquette, etc. Trying their new server with many different clients.

I was involved in several interops where the client and server worked fine with each other - and the protocol traces looked good, but assumptions were made about the behaviour of clients or servers and so it didn't interoperate.

Best
Paul


On 22 November 2016 at 04:45, kushal bhattacharya <bhattacharya.kushal4@gmail.com> wrote:
actually my company requires me to build own pewrsonalised mqtt client and broker i had to make all of the implementations from scratch and thus these are the stuffs which are creating some confusions

--
To learn more about MQTT please visit http://mqtt.org
---
You received this message because you are subscribed to the Google Groups "MQTT" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mqtt+unsubscribe@googlegroups.com.
To post to this group, send email to mq...@googlegroups.com.
Visit this group at https://groups.google.com/group/mqtt.
For more options, visit https://groups.google.com/d/optout.

Filipe Nicoli

unread,
Nov 24, 2016, 2:20:09 PM11/24/16
to MQTT
I fail to understand your actual question. Are you unsure about which part of the implementation?

As far as I know, cleansession is a flag defined by the client to tell the server (broker) that there might be messages left on the buffer for that client (i.e. QoS1/2 messages, subscriptions...).
If you're generating random client ids, you might as well set that flag to be false since you'll never have the same client connecting twice.

It all depends on what you wan't to do with your implementation.

kushal bhattacharya

unread,
Nov 24, 2016, 11:58:18 PM11/24/16
to MQTT

yes but i will have both the scenarios of the flag that is i  will have to consider both the scenarios of clean session flag true and false .So my intention is to consider the case of both random client id when cleans session flag is false and there will be match in client id for the same client if clean session flag is set to true
Reply all
Reply to author
Forward
0 new messages