[Mosquitto-users] Mosquitto and MySQL

2012-07-26 Thread stefano costa

Hello,
starting to imagine a "serious" application with Mosquitto (or better, 
with MQTT and Mosquitto as a broker) I was asking myself if anyone 
investigated about a best practice for keeping messages archived, for 
later queries and statistics or any other usage.


MySQL is my first choice, as it's considered a standard if I need to offer 
some kind of link to a webserver or remote ODBC connector.


Two different approaches:
- modify the broker so that it saves messages directly to MySQL instead of 
the present way (flat file? SQLite? What's today??) PRO: best integration 
CON: difficult to be maintained and configured
- build a separate application that subscribes/publish to the broker and 
saves/retrieves to MySQL with standard SQL queries. PRO: extensible and 
configurable CON: another application to be maintained


Any useful idea about this scenario?

Thanks S

--
  Stefano Costa, R&D Manager
  M +39 335 6565749
  Skype stefanocosta.bluewind
  http://www.bluewind.it/stefanoco?code=9


--
Mailing list: https://launchpad.net/~mosquitto-users
Post to : mosquitto-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mosquitto-users
More help   : https://help.launchpad.net/ListHelp


Re: [Mosquitto-users] Mosquitto and MySQL

2012-07-26 Thread stefano costa

Roger Light ha scritto:

Hi Stefano,


Two different approaches:
- modify the broker so that it saves messages directly to MySQL instead of
the present way (flat file? SQLite? What's today??) PRO: best integration
CON: difficult to be maintained and configured

At the moment the broker only keeps retained messages when it saves to
disk so I doubt that would be sufficient. I do envisage at some point
mosquitto providing an interface that you could get access to this
sort of information direct from the broker without having to develop a
separate app. I've not even considered how that would look though, so
don't hold your breath for it.


...correct: the broker task is limited to this, and it would be wrong to 
assign also the responsibility of maintaining copies of messages in a 
database etc.! From an architectural point of view, this was a mistake in 
my thoughts.



- build a separate application that subscribes/publish to the broker and
saves/retrieves to MySQL with standard SQL queries. PRO: extensible and
configurable CON: another application to be maintained

I think you could do it very simply actually, so it's probably less
maintenance than integrating code into the broker. I've got a simple
example of this very thing in the 0.16 branch in examples/mysql_log/


Ok I'll have a look at this, thanks for pointing me to examples I didn't 
consider. This is the way to go. I can't promise much but it may be 
possible that I end up committing some more complex example or application 
in the near future.


--
  Stefano Costa, R&D Manager
  M +39 335 6565749
  Skype stefanocosta.bluewind
  http://www.bluewind.it/stefanoco?code=5


--
Mailing list: https://launchpad.net/~mosquitto-users
Post to : mosquitto-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mosquitto-users
More help   : https://help.launchpad.net/ListHelp


[Mosquitto-users] mosquitto_sub and clean session flag disable

2012-07-27 Thread stefano costa

Hello,
I know I'm missing something. I'm trying to use the "no clean session" 
feature:



On one terminal:

stefanoco@stefanocopc:~$ mosquitto_sub -c -i "6748" -v -t "diag/#"
diag/pippo 139
diag/pippo 140
diag/pippo 141


On another terminal right after the sub command:

stefanoco@stefanocopc:~$ mosquitto_pub -i "7748" -q 1 -t "diag/par01" -m 
"139"
stefanoco@stefanocopc:~$ mosquitto_pub -i "7748" -q 1 -t "diag/par01" -m 
"140"
stefanoco@stefanocopc:~$ mosquitto_pub -i "7748" -q 1 -t "diag/par01" -m 
"141"



Everything ok. Now, having used the "-c" flag in sub, I expect that if I 
kill mosquitto_sub, then publish more messages with above lines, and the 
launch again mosquitto_sub I get the messages in queue. I'm getting 
nothing... is there anything I should look after in mosquitto.conf?




By the way: using the same id for pub/sub causes sub to exit suddenly (I 
know I shouldn't but this is not an intended behaviour I guess?)



Thanks a lot S

--
  Stefano Costa, R&D Manager
  M +39 335 6565749
  Skype stefanocosta.bluewind
  http://www.bluewind.it/stefanoco?code=7


--
Mailing list: https://launchpad.net/~mosquitto-users
Post to : mosquitto-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mosquitto-users
More help   : https://help.launchpad.net/ListHelp


[Mosquitto-users] mosquitto_sub and clean session flag disable

2012-07-27 Thread stefano costa

Sorry the previous message contains wrong topics... this is correct
_
Hello,
I know I'm missing something. I'm trying to use the "no clean session" 
feature:



On one terminal:

stefanoco@stefanocopc:~$ mosquitto_sub -c -i "6748" -v -t "diag/#"
diag/par01 139
diag/par01 140
diag/par01 141


On another terminal right after the sub command:

stefanoco@stefanocopc:~$ mosquitto_pub -i "7748" -q 1 -t "diag/par01" -m "139"
stefanoco@stefanocopc:~$ mosquitto_pub -i "7748" -q 1 -t "diag/par01" -m "140"
stefanoco@stefanocopc:~$ mosquitto_pub -i "7748" -q 1 -t "diag/par01" -m "141"


Everything ok. Now, having used the "-c" flag in sub, I expect that if I 
kill mosquitto_sub, then publish more messages with above lines, and the 
launch again mosquitto_sub I get the messages in queue. I'm getting 
nothing... is there anything I should look after in mosquitto.conf?




By the way: using the same id for pub/sub causes sub to exit suddenly (I 
know I shouldn't but this is not an intended behaviour I guess?)



Thanks a lot S

--
  Stefano Costa, R&D Manager
  M +39 335 6565749
  Skype stefanocosta.bluewind
  http://www.bluewind.it/stefanoco?code=7


--
Mailing list: https://launchpad.net/~mosquitto-users
Post to : mosquitto-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mosquitto-users
More help   : https://help.launchpad.net/ListHelp


[Mosquitto-users] MQTTs

2012-09-11 Thread stefano costa

Hello,
I'm interested in MQTTs: anyone working at extending somehow Mosquitto in 
this direction and willing to exchange ideas?


--
  Stefano Costa, R&D Manager
  M +39 335 6565749
  Skype stefanocosta.bluewind
  http://www.bluewind.it/stefanoco?code=8


--
Mailing list: https://launchpad.net/~mosquitto-users
Post to : mosquitto-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mosquitto-users
More help   : https://help.launchpad.net/ListHelp


[Mosquitto-users] Retained messages

2012-09-18 Thread stefano costa

Hello,
we're developing a simple application (daemon) that will create an history 
of messages published on a broker, more on this as soon as I have a first 
draft of the architecture. This is related to a product under development 
but I think it could be useful also to others.


In order to be as generic as possible it would be useful to have a chance 
of knowing if a message that I receive as a subscriber to a broker has 
been published with the "retained" flag set. Is this piece of information 
available? I didn't find any indication from the subscriber point of view.


Thanks S.

--
  Stefano Costa, R&D Manager
  M +39 335 6565749
  Skype stefanocosta.bluewind
  http://www.bluewind.it/stefanoco?code=9


--
Mailing list: https://launchpad.net/~mosquitto-users
Post to : mosquitto-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mosquitto-users
More help   : https://help.launchpad.net/ListHelp


Re: [Mosquitto-users] Retained messages

2012-09-18 Thread stefano costa
Thanks Roger, now more details are very clear to me. I'll take this into 
account and find a way.


S

Roger Light ha scritto:

Hi Stefano,

The retained flag has different meanings depending on whether a
message is going from the client to the broker or broker to client.
For a message from the client to the broker, if the retained flag is
set the client is telling the broker that this message should be
retained as the last known good value. When a message from the broker
to the client has the retained flag set, the broker is telling the
client that this message is not fresh - it may have been sat as a
retained value for a long time. This will only happen when the client
first subscribes to a topic with the first set of messages received.
All messages after this are sent to the client as soon as they are
received. The upshot is that a client with a subscription has no way
of knowing if a message was intended to be retained or not.

Both mosquitto and rsmb implement a mode where if a client sets the
MSB of the protocol version byte in the CONNECT command (i.e. the
protocol version is 0x83 instead of 0x03) then it is telling the
broker that it is a bridge. This means that retained message state is
propagated, which is what you want. It also means that any messages
the client sends to the broker are not echoed back to it which is
important to help prevent message loops. This functionality is not
currently part of the spec, but I anticipate that it will be in the
next revision.

Cheers,

Roger


On Tue, Sep 18, 2012 at 8:55 AM, stefano costa
 wrote:

Hello,
we're developing a simple application (daemon) that will create an history
of messages published on a broker, more on this as soon as I have a first
draft of the architecture. This is related to a product under development
but I think it could be useful also to others.

In order to be as generic as possible it would be useful to have a chance of
knowing if a message that I receive as a subscriber to a broker has been
published with the "retained" flag set. Is this piece of information
available? I didn't find any indication from the subscriber point of view.

Thanks S.

--
   Stefano Costa, R&D Manager
   M +39 335 6565749
   Skype stefanocosta.bluewind
   http://www.bluewind.it/stefanoco?code=9


--
Mailing list: https://launchpad.net/~mosquitto-users
Post to : mosquitto-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mosquitto-users
More help   : https://help.launchpad.net/ListHelp



--
  Stefano Costa, R&D Manager
  M +39 335 6565749
  Skype stefanocosta.bluewind
  http://www.bluewind.it/stefanoco?code=4


--
Mailing list: https://launchpad.net/~mosquitto-users
Post to : mosquitto-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mosquitto-users
More help   : https://help.launchpad.net/ListHelp


[Mosquitto-users] New testbed server

2012-09-19 Thread stefano costa

  
  
Hello,
we're about to setup a "testbed server" here for public usage. I
hope it's good to announce it here; I'm inviting the readers of this
list to use it for individual tests.

Our first goal is to try to have as much traffic as possible in
order to stress and check stability and performance of Mosquitto
both as a broker and as a library and will regularly post any issue
and result here. Of course we will also try to generate traffic from
our office here and using external devices (mostly GPRS based
vehicle trackers and similar).

The testbed will be public and very simple at first, more features
to be added also following your suggestions if any. Anyone will be
able to subscribe and "see" what's going on, so please don't post
private data of course!!

- server public address "iot.bluewind.it"
- broker available at port 1883
- simple web page showing current mosquitto.conf content, at port 80
- the server will also run an application (Cpp) "wrapping" messages
and creating a sort of permanent history like this:
  - the wrapper subscribes to a category of messages with:
    -t "/serialize/#"
  - when someone publishes under this category eg. with:
    -t "/serialize/sensor/temperature/001", -m "10E-1"
  - the wrapper will receive the message, process and publish a new
version under a special category adding a timestamp to its path and
making it "retained":
    -r -t
  "/serialize/history/2012/09/20/103230/16667/sensor/temperature/001",
  -m "10E-1"
    where:
    ".../2012/09/20/103230/..." is year,
month, day, hour, minute, second added and
    ".../16667/..." is a random number added
    
Hope the description is clear... suggestions invited! Will be up and
running in a few days.

Thanks S.
-- 
  Stefano Costa, R&D Manager
  M +39 335 6565749
  Skype stefanocosta.bluewind
  http://www.bluewind.it/stefanoco?code=16
  


-- 
Mailing list: https://launchpad.net/~mosquitto-users
Post to : mosquitto-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mosquitto-users
More help   : https://help.launchpad.net/ListHelp


[Mosquitto-users] Details about Mosquitto PPA

2012-09-19 Thread stefano costa

Hello,
not sure if this is the right way of reporting this... but I found that 
the description about how to install Mosquitto on Ubuntu (a rather 
frequent situation) could be a bit more complete, in the 
"http://mosquitto.org/download/"; page of Mosquitto web site.


Now there is an indication like this:


add the mosquitto-dev PPA to your repositories list – see the link for 
details. mosquitto can then be installed from your package manager.

* apt-add-repository ppa:mosquitto-dev/mosquitto-ppa


Two problems:
- if I already have Mosquitto installed time ago from the official Ubuntu 
Repositories, this command is not sufficient in order to upgrade Mosquitto 
to a more recent version from ppa:mosquitto.
- if I'm working on a Ubuntu Server edition the command 
"apt-add-repository" may not be present.


So I would suggest this as an indication:


add the mosquitto-dev PPA to your repositories list – see the link for 
details. mosquitto can then be installed from your package manager.

* sudo apt-add-repository ppa:mosquitto-dev/mosquitto-ppa
* sudo apt-get update

In case the command "apt-add-repository" is not being recognized, it can 
be installed with:

* sudo apt-get install python-software-properties


Thanks!! S

--
  Stefano Costa, R&D Manager
  M +39 335 6565749
  Skype stefanocosta.bluewind
  http://www.bluewind.it/stefanoco?code=12


--
Mailing list: https://launchpad.net/~mosquitto-users
Post to : mosquitto-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mosquitto-users
More help   : https://help.launchpad.net/ListHelp


[Mosquitto-users] Wildcard and retained messages

2012-09-20 Thread stefano costa

  
  
Hello, I'm not sure if this is a bug or intentional.

On first side:
mosquitto_sub -v -h brokerhost -t "#"

On second side:
mosquitto_pub -r -h brokerhost -t "sensor/001" -m "9912" 
<== this message is shown on first side
mosquitto_pub -r -h brokerhost -t "/sensor/001" -m "9912" 
<== this message is NOT shown on first side due to the leading
"/" in topic

Up to this, it's correct. But please note that the two messages are
sent with "retained" set, and so if I launch again:
mosquitto_sub -v -h brokerhost -t "#"

now I get both retained messages:
/sensor/001 9912  <=== this could be an
error?
sensor/001 9912

while if I launch:
mosquitto_sub -v -h brokerhost -t "/#" (note
the "/#" instead of "#")

what I get is only one retained message:
/sensor/001 9912


Thanks S

-- 
  Stefano Costa, R&D Manager
  M +39 335 6565749
  Skype stefanocosta.bluewind
  http://www.bluewind.it/stefanoco?code=18
  


-- 
Mailing list: https://launchpad.net/~mosquitto-users
Post to : mosquitto-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mosquitto-users
More help   : https://help.launchpad.net/ListHelp


[Mosquitto-users] New testbed server

2012-09-20 Thread stefano costa

  
  
Hello,
the testbed already mentioned in a message earlier this week is now
up and running in a first experimental configuration. Up to now we
don't have a webpage, only a broker is configured and available. I'm
inviting the readers of this list to use it for individual tests.

Our first goal is to try to have as much traffic as possible in
order to stress and check stability and performance of Mosquitto
both as a broker and as a library and will regularly post any issue
and result here. Of course we will also try to generate traffic from
our office here and using external devices (mostly GPRS based
vehicle trackers and similar).

The testbed will be public and very simple at first, more features
to be added also following your suggestions if any. Anyone will be
able to subscribe and "see" what's going on, so please don't post
private data of course!!

- server public address "iot.bluewind.it"
- broker available at port 1883
[- simple web page showing current mosquitto.conf content, at port
80] (not yet available)
- the server will also run an application (Cpp) "wrapping" messages
and creating a sort of permanent history like this:
  - the wrapper subscribes to a category of messages with:
    -t "/serialize/#"
  - when someone publishes under this category eg. with:
    -t "/serialize/sensor/temperature/001", -m "10E-1"
  - the wrapper will receive the message, process and publish a new
version under a special category adding a timestamp to its path and
making it "retained":
    -r -t
  "/history/2012/09/20/103230/16667/sensor/temperature/001", -m
  "10E-1"
    where:
    ".../2012/09/20/103230/..." is year,
month, day, hour, minute, second added and
    ".../16667/..." is a random number added

Hope the description is clear... suggestions invited!

Thanks S.
-- 
  Stefano Costa, R&D Manager
  M +39 335 6565749
  Skype stefanocosta.bluewind
  http://www.bluewind.it/stefanoco?code=16
  

-- 
Mailing list: https://launchpad.net/~mosquitto-users
Post to : mosquitto-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mosquitto-users
More help   : https://help.launchpad.net/ListHelp

-- 
Mailing list: https://launchpad.net/~mosquitto-users
Post to : mosquitto-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mosquitto-users
More help   : https://help.launchpad.net/ListHelp


[Mosquitto-users] Python-based example not working any more

2012-12-19 Thread stefano costa
I'm preparing a very simple demo for clients, starting from this example 
that links Twitter streams to MQTT messages:


https://github.com/knolleary/twitter-to-mqtt

While doing tests I had the bad idea of upgrading the entire Mosquitto 
library and applications and the Python script here stopped working... I'm 
just trying to post here in case anyone else experienced similar problem. 
The problem is: I have no idea of the Mosquitto version that made the 
example work! Could have been 1.0.2 but this is not sure. Now it's 1.0.5 
and the result is: this Twitter/Python example is not able to connect to 
the same broker (the broker being 1.0.5 since the origin). No connection 
without any error and without waiting to timeouts (less than a second).


I tested a few other Python examples and all of them are still working, 
must be the implementation inside "twitter-to-mqtt.py" but can't 
understand what's wrong.


Thanks for giving ideas!
S

--
  Stefano Costa, R&D Manager
  M +39 335 6565749
  Skype stefanocosta.bluewind
  http://www.bluewind.it/stefanoco?code=11


--
Mailing list: https://launchpad.net/~mosquitto-users
Post to : mosquitto-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mosquitto-users
More help   : https://help.launchpad.net/ListHelp


Re: [Mosquitto-users] Python-based example not working any more

2012-12-19 Thread stefano costa

Roger Light ha scritto:
...changed a bit for 1.0. If you pull the new version hopefully it 
should work fine now. Cheers, Roger 


Roger, Nick,
really fast, it works now!!! Just tweaking a bit so that the clean 
twittered text and not the raw stream is passed as payload to MQTT, and 
the demo is ready.


Thanks! S


--
  Stefano Costa, R&D Manager
  M +39 335 6565749
  Skype stefanocosta.bluewind
  http://www.bluewind.it/stefanoco?code=8


--
Mailing list: https://launchpad.net/~mosquitto-users
Post to : mosquitto-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mosquitto-users
More help   : https://help.launchpad.net/ListHelp


[Mosquitto-users] LabVIEW

2013-01-08 Thread stefano costa
Hello, developing products that speak MQTT... a need arise for a National 
Instruments LabVIEW function block that can talk the same! Before starting 
an integration (perhaps) based on the existing mqttdotnet, any work 
already done on this? Of course the two client commands are needed 
(pub/sub) and not the broker itself.


Thanks S.

--
  Stefano Costa, R&D Manager
  M +39 335 6565749
  Skype stefanocosta.bluewind
  http://www.bluewind.it/stefanoco?code=7


--
Mailing list: https://launchpad.net/~mosquitto-users
Post to : mosquitto-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mosquitto-users
More help   : https://help.launchpad.net/ListHelp


[Mosquitto-users] Bridge: MQTT / Twitter

2013-01-10 Thread stefano costa
This is to announce (another) simple bridge between MQTT and Twitter, 
based on a couple of applications written in Ruby:


https://github.com/bluewindthings/twitter-to-mqtt-daemon
https://github.com/bluewindthings/mqtt-to-twitter-daemon

Both are under development in our labs now but already fairly stable it 
seems; we decided to write them from scratch because we need a few options 
not already available on other implementations: daemon wrap, multiple 
topics, etc. (see README for both).


Thanks S.
Stefano Costa, Bluewind

--
  Stefano Costa, R&D Manager
  M +39 335 6565749
  Skype stefanocosta.bluewind
  http://www.bluewind.it/stefanoco?code=15


--
Mailing list: https://launchpad.net/~mosquitto-users
Post to : mosquitto-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mosquitto-users
More help   : https://help.launchpad.net/ListHelp


[Mosquitto-users] MQTT to database

2013-01-25 Thread stefano costa
Announcing another piece of (very simple) software coming out of our test 
lab: subscribing to some topics and converting each publication into a 
database record.


Again, this is already done; there's an example coming with Mosquitto and 
other implementations around but we preferred to start with a brand new 
daemon written in Ruby and using standard libraries that simplify things 
and give easy APIs for customization.


So this is currently running at things.bluewind.it:

https://github.com/bluewindthings/mqtt-to-sql-daemon

Stay tuned for improvements and please give also feedback is needed. Thanks S.

--
  Stefano Costa, R&D Manager
  M +39 335 6565749
  Skype stefanocosta.bluewind
  http://www.bluewind.it/stefanoco?code=18


--
Mailing list: https://launchpad.net/~mosquitto-users
Post to : mosquitto-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mosquitto-users
More help   : https://help.launchpad.net/ListHelp


[Mosquitto-users] Announc. another Ruby on Rails tool for Messaging

2013-02-08 Thread stefano costa

Another "brick" of our architecture has been released here open to comments:

https://github.com/bluewindthings/sql-to-html

This closes the loop with a mini-website well represented also here in 
this demo:

http://things.bluewind.it/  (feel free to register for full access)


Thanks

--
  Stefano Costa, R&D Manager
  M +39 335 6565749
  Skype stefanocosta.bluewind
  http://www.bluewind.it/stefanoco?code=12


--
Mailing list: https://launchpad.net/~mosquitto-users
Post to : mosquitto-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mosquitto-users
More help   : https://help.launchpad.net/ListHelp


[Mosquitto-users] Updated republisher daemon

2013-03-07 Thread stefano costa

Hello folks,
it maybe worth announcing a minor revision of our Ruby republishing daemon:

https://github.com/bluewindthings/mqtt-republisher-daemon

The interesting feature we added is a regex-based rule that's (optionally) 
applied to messages upon rewriting the topic. This way it becomes even 
more general purpose in the design of a public service.


Thanks S.

--
  Stefano Costa, R&D Manager
  M +39 335 6565749
  Skype stefanocosta.bluewind
  http://www.bluewind.it/stefanoco?code=4


--
Mailing list: https://launchpad.net/~mosquitto-users
Post to : mosquitto-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mosquitto-users
More help   : https://help.launchpad.net/ListHelp


[Mosquitto-users] MQTTs gateway

2013-03-21 Thread stefano costa
An interesting new development has recently been published on GITHub, a 
client for MQTTS. But: is there any MQTTS/MQTT out there, or 
MQTTS-compliant broker?


Thanks S

--
  Stefano Costa, R&D Manager
  M +39 335 6565749
  Skype stefanocosta.bluewind
  http://www.bluewind.it/stefanoco?code=17


--
Mailing list: https://launchpad.net/~mosquitto-users
Post to : mosquitto-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mosquitto-users
More help   : https://help.launchpad.net/ListHelp


[Mosquitto-users] pub / sub binding to specific address or interface

2013-05-31 Thread Stefano Costa

Hello,
the Mosquitto broker is able to bind to any specific address (and 
interface as a consequence) by configuration file.


I was asking myself if the same applies to the pub and sub functions of 
the library: I can't see any such option (parameter), any workaround for 
this?


Example: embedded device with both Wifi and GPRS (ppp) up at the same 
time and I need to pub / sub on both interfaces depending on frequency / 
importance of events.


Thanks S


--
  Stefano Costa, R&D Manager
  M +39 335 6565749
  Skype stefanocosta.bluewind
  Twitter @stefanobluewind
  http://www.bluewind.it

--
Mailing list: https://launchpad.net/~mosquitto-users
Post to : mosquitto-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mosquitto-users
More help   : https://help.launchpad.net/ListHelp


Re: [Mosquitto-users] pub / sub binding to specific address or interface

2013-05-31 Thread Stefano Costa

Roger, no words... thanks!
S

Il 31/05/2013 22:33, Roger Light ha scritto:

Hi Stefano,

Consider it done:

https://bitbucket.org/oojah/mosquitto/commits/db5147ce80f1b612986bca0778e201f94532de5e

Cheers,

Roger

On Fri, May 31, 2013 at 10:20 AM, Roger Light  wrote:

Hi Stefano,

This isn't supported currently, but consider it on the list for version 1.2.

Cheers,

Roger


On Fri, May 31, 2013 at 9:34 AM, Stefano Costa
 wrote:

Hello,
the Mosquitto broker is able to bind to any specific address (and interface
as a consequence) by configuration file.

I was asking myself if the same applies to the pub and sub functions of the
library: I can't see any such option (parameter), any workaround for this?

Example: embedded device with both Wifi and GPRS (ppp) up at the same time
and I need to pub / sub on both interfaces depending on frequency /
importance of events.

Thanks S


--
   Stefano Costa, R&D Manager
   M +39 335 6565749
   Skype stefanocosta.bluewind
   Twitter @stefanobluewind
   http://www.bluewind.it

--
Mailing list: https://launchpad.net/~mosquitto-users
Post to : mosquitto-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mosquitto-users
More help   : https://help.launchpad.net/ListHelp



--
Mailing list: https://launchpad.net/~mosquitto-users
Post to : mosquitto-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mosquitto-users
More help   : https://help.launchpad.net/ListHelp


[Mosquitto-users] Wild card

2013-06-03 Thread Stefano Costa

Hello,
I have a doubt about wildcard usage. I can see something (perhaps) 
strange and before investigating in the wrong direction I want to check 
if this is simply my wrong assumption.


What I can see as an example is:

mosquitto_sub -v -h things.bluewind.it -t "#"
--> this shows immediately all topics that have been published as 
"retained", both beginning or not with a "/":

--> BUT then will only show topics being published NOT beginning with a "/".


mosquitto_sub -v -h things.bluewind.it -t "/#"
--> this shows immediately only the two topics that have been published 
as "retained" AND begin with a "/":

--> and then will only show topics being published beginning with a "/".

Is this correct and/or intended behaviour? It seems to me that the 
second situation is correct, but in the first situation I expect a 
coherent behaviour for retained / current pubs (why not show all topics, 
also beginning with a "/"?).


Thanks!! S

--
  Stefano Costa, R&D Manager
  M +39 335 6565749
  Skype stefanocosta.bluewind
  Twitter @stefanobluewind
  http://www.bluewind.it

--
Mailing list: https://launchpad.net/~mosquitto-users
Post to : mosquitto-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mosquitto-users
More help   : https://help.launchpad.net/ListHelp


Re: [Mosquitto-users] Wild card

2013-06-03 Thread Stefano Costa

On 06/03/2013 01:08 PM, Roger Light wrote:

Hi Stefano,

The behaviour you describe is incorrect. It is better explained using
a longer topic - let's set sensors/temperature sensors/humidity etc.

A subscription to sensors/# would match on sensors/temperature,
sensors/humidity *and* sensors. If we imagine that a subscription to
/# is actually a subscription to ""/# (i.e. an empty topic followed by
/ followed by #) then a subscription to /# should match against "" as
well as anything below it such as /foo/bar (""/foo/bar). A
subscription to # on the other hand will match everything, including
""/foo/bar.

The slightly confounding bit is that topics must be at least one
character long, so it is not possible to publish to "", which would
match against ""/#.

The current mosquitto code (you really should upgrade) works correctly
for subscriptions to # but not for retained messages when subscribing
to /# (it returns messages with topics without a leading slash). I'll
get that fixed.



Thanks a lot Roger now I can explain what I see. We will also upgrade 
our brokers and client in the meantime!

S


--
  Stefano Costa, R&D Manager
  M +39 335 6565749
  Skype stefanocosta.bluewind
  Twitter @stefanobluewind
  http://www.bluewind.it

--
Mailing list: https://launchpad.net/~mosquitto-users
Post to : mosquitto-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mosquitto-users
More help   : https://help.launchpad.net/ListHelp


Re: [Mosquitto-users] Wild card

2013-06-05 Thread Stefano Costa

Il 05/06/2013 22:29, Roger Light ha scritto:

On Mon, Jun 3, 2013 at 12:08 PM, Roger Light  wrote:


The current mosquitto code (you really should upgrade) works correctly
for subscriptions to # but not for retained messages when subscribing
to /# (it returns messages with topics without a leading slash). I'll
get that fixed.

This should be fixed now:
https://bitbucket.org/oojah/mosquitto/commits/ba0eaee9858bfd2d931296d554c2821e401e03f7

Cheers,

Roger


Roger, thanks! I'll give ti a try at the next upgrade
S

--
Mailing list: https://launchpad.net/~mosquitto-users
Post to : mosquitto-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mosquitto-users
More help   : https://help.launchpad.net/ListHelp


[Mosquitto-users] SYS statistics

2013-07-18 Thread Stefano Costa

Hello,
before I start investigating further: it seems to me that the statistics 
offered by subscribing to $SYS are not accurate; I'm looking at:


$SYS/broker/messages/received
$SYS/broker/messages/sent

and both counters seem not to reflect actual messages exchanged during a 
session with a high rate (say 10 messages per second).


Anything similar already seen?
Thanks

--
  Stefano Costa, R&D Manager
  M +39 335 6565749
  Skype stefanocosta.bluewind
  Twitter @stefanobluewind
  http://www.bluewind.it


--
Mailing list: https://launchpad.net/~mosquitto-users
Post to : mosquitto-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mosquitto-users
More help   : https://help.launchpad.net/ListHelp


[Mosquitto-users] Listener / mount points bound to auth user

2013-08-05 Thread Stefano Costa
I think that an option for the broker would be useful: when a client 
connects with auth (any kind of), a specific mount point is optionally 
added to the topic name (both sub and pub). This way I'm able to group 
together users (perhaps multitudes of clients having the same identity) 
exactly the same way I can now for listeners.


As an example, this would be useful when a broker is being used for 
classes of devices and I don't want to proliferate public FQDNs / IPs or 
reserve new ports as new classes are added.


What do you think?

--
  Stefano Costa, R&D Manager
  M +39 335 6565749
  Skype stefanocosta.bluewind
  Twitter @stefanobluewind
  http://www.bluewind.it


--
Mailing list: https://launchpad.net/~mosquitto-users
Post to : mosquitto-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mosquitto-users
More help   : https://help.launchpad.net/ListHelp


[Mosquitto-users] MQTT and OpenHAB

2013-09-01 Thread Stefano Costa
I'm trying to configure MQTT binding for OpenHAB without success so far 
(http://code.google.com/p/openhab/) and apart from asking in OpenHAB 
list of course, would like to understand if anyone here have 
experience... by the way, really interesting application!

S
--
   Stefano Costa, R&D Manager
   M +39 335 6565749
   Skype stefanocosta.bluewind
   Twitter @stefanobluewind
   http://www.bluewind.it

--
Mailing list: https://launchpad.net/~mosquitto-users
Post to : mosquitto-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mosquitto-users
More help   : https://help.launchpad.net/ListHelp


[Mosquitto-users] Listener / mount points and auth user

2013-09-08 Thread Stefano Costa

Same topic here:
https://lists.launchpad.net/mosquitto-users/msg00271.html

(sorry can't understand how to continue discussion on an existing topic 
on the web...)


Roger wrote:
"
It's an interesting idea, feel free to submit it as a bug report. You
can already achieve it to a limited degree by using a mount point on a
listener that doesn't allow anonymous connections.

As far as I understand, defining a mount point related to a listener 
will add a check: "user uid will only send/receive messages starting 
with /cl/uid"; my aim is at reducing traffic and using simple setups, 
where authentication is also a way for distributing messages across 
different topic hierarchies.


Is this possible with an ACL plugin? I guess not because the plugin is 
not dealing with topics...


Thanks


--
   Stefano Costa, R&D Manager
   M +39 335 6565749
   Skype stefanocosta.bluewind
   Twitter @stefanobluewind
   http://www.bluewind.it

--
Mailing list: https://launchpad.net/~mosquitto-users
Post to : mosquitto-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mosquitto-users
More help   : https://help.launchpad.net/ListHelp


[Mosquitto-users] mosquitto.conf and "pattern" vs "topic" (ACL)

2013-09-08 Thread Stefano Costa
I was playing with both mentioned options. I'm not using any auth here, 
plain pub / sub. Mosquitto version 1.2


My simple setup is:

(1) mosquitto.conf: mostly default, with added

"acl_file /etc/mosquitto/mosquitto_acl.conf"

(2) mosquitto_acl.conf content

  (a) only "pattern /clid/%c/data"
  (b) only "topic /clid/#"

(3) on first terminal:
  mosquitto_sub -h localhost -v -t "#"

(4) on second terminal:
  mosquitto_pub -h localhost -i "pippo" -t "/clid/pippo/data" -m "99"

Done several tests with (a) and (b), looking at logs etc and it seems 
that while (b) works filtering only /clid/# topics, (a) does not work in 
this setup: nothings is published.


Maybe "pattern" only works for authenticated clients? But it makes 
reference only to client id in this setup.


Thanks

--
   Stefano Costa, R&D Manager
   M +39 335 6565749
   Skype stefanocosta.bluewind
   Twitter @stefanobluewind
   http://www.bluewind.it

--
Mailing list: https://launchpad.net/~mosquitto-users
Post to : mosquitto-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mosquitto-users
More help   : https://help.launchpad.net/ListHelp


Re: [Mosquitto-users] mosquitto.conf and "pattern" vs "topic" (ACL)

2013-09-08 Thread Stefano Costa

Il 08/09/2013 11:21, Roger Light ha scritto:

Hi Stefano,


   (a) only "pattern /clid/%c/data"


I suspect the problem that you're seeing here is that if this is your
only acl, then other clients won't be able to see that topic. This
means your mosquitto_sub instance won't receive the messages, even
though it is subscribed to #.

You could try something like this instead (how you do it depends on
what you're trying to achieve of course)

topic read #
pattern write /clid/%c/data


Yes seems to make sense but still does not work... any idea why? I'll 
try having a look at Mosquitto code anyway.





Or you could add a user line to only allow read access to a specific user.

If you can't do what you want, you can write a plugin to do it -
https://github.com/jpmens/mosquitto-auth-plug is a great example.


Sure I'm studying this, trying also to understand if I can achieve my 
other goal of having each user "confined" under a specific topics tree 
(see my other post today). Or better: my colleagues will, I'm not (any 
more) so good at building real C/C++ applications!


Can't find a description of expected auth plugins API, does it exist?


Thanks again


--
   Stefano Costa, R&D Manager
   M +39 335 6565749
   Skype stefanocosta.bluewind
   Twitter @stefanobluewind
   http://www.bluewind.it

--
Mailing list: https://launchpad.net/~mosquitto-users
Post to : mosquitto-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mosquitto-users
More help   : https://help.launchpad.net/ListHelp


Re: [Mosquitto-users] mosquitto.conf and "pattern" vs "topic" (ACL)

2013-09-08 Thread Stefano Costa

Il 08/09/2013 16:42, Karl P ha scritto:



On 09/08/2013 02:23 PM, Stefano Costa wrote:


# Allow local (anonymous) users full access
topic #

# This is required so that bridge status notifications work
pattern write $SYS/broker/connection/%c/state
# secure clients from the net can only access their own topics.
pattern +/%u/#





...well I'm sure I'm doing something wrong but can't make this work! Any 
hint?


I'm trying this simple setup for ACL file:

topic #

user pippo
pattern write /clid/%c/data

(with variants: %u instead of %c, "topic read #", without "user pippo" 
etc etc) and giving client commands like:


mosquitto_sub -v -h localhost --username "super" --pw "super" -t "#"
mosquitto_sub -v -h localhost -t "#"
mosquitto_sub -v -h localhost -i "pippo" -t "#"

and

mosquitto_pub -h localhost -i "pippo" -u "pippo" -P "plauto"\
-t "/clid/pippo/data" -m "99"

...but never have the message published! I'm also looking at log, 
nothing strange... commenting the ACL file content of course messages 
start flowing.





--
   Stefano Costa, R&D Manager
   M +39 335 6565749
   Skype stefanocosta.bluewind
   Twitter @stefanobluewind
   http://www.bluewind.it

--
Mailing list: https://launchpad.net/~mosquitto-users
Post to : mosquitto-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mosquitto-users
More help   : https://help.launchpad.net/ListHelp


Re: [Mosquitto-users] mosquitto.conf and "pattern" vs "topic" (ACL)

2013-09-08 Thread Stefano Costa
Update: the message is published ONLY if I use the same user/pwd both on 
pub and sub, like this (same ACL as below):


mosquitto_sub -v -h localhost -u "pippo" -P "plauto" -t "#"

and

mosquitto_pub -h localhost -i "pippo" -u "pippo" -P "plauto"\
-t "/clid/pippo/data" -m "99"


...but I'm pretty sure this is not the intended behaviour.


Il 08/09/2013 16:42, Karl P ha scritto:



On 09/08/2013 02:23 PM, Stefano Costa wrote:


# Allow local (anonymous) users full access
topic #

# This is required so that bridge status notifications work
pattern write $SYS/broker/connection/%c/state
# secure clients from the net can only access their own topics.
pattern +/%u/#





...well I'm sure I'm doing something wrong but can't make this work! Any 
hint?


I'm trying this simple setup for ACL file:

topic #

user pippo
pattern write /clid/%c/data

(with variants: %u instead of %c, "topic read #", without "user pippo" 
etc etc) and giving client commands like:


mosquitto_sub -v -h localhost --username "super" --pw "super" -t "#"
mosquitto_sub -v -h localhost -t "#"
mosquitto_sub -v -h localhost -i "pippo" -t "#"

and

mosquitto_pub -h localhost -i "pippo" -u "pippo" -P "plauto"\
-t "/clid/pippo/data" -m "99"

...but never have the message published! I'm also looking at log, 
nothing strange... commenting the ACL file content of course messages 
start flowing.





--
   Stefano Costa, R&D Manager
   M +39 335 6565749
   Skype stefanocosta.bluewind
   Twitter @stefanobluewind
   http://www.bluewind.it

--
Mailing list: https://launchpad.net/~mosquitto-users
Post to : mosquitto-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mosquitto-users
More help   : https://help.launchpad.net/ListHelp


Re: [Mosquitto-users] mosquitto.conf and "pattern" vs "topic" (ACL)

2013-09-09 Thread Stefano Costa

On 09/08/2013 11:25 PM, Roger Light wrote:

Hi Stefano,


pattern write /clid/%c/data

Yes, ok I agree this doesn't work. I'll fix it for 1.2.1, which should
be next week.

Ok thanks Roger!

Sometimes I do have time to dig into code... not always.



The problem was around ACL with a leading / not matching properly. If
you scrap the leading / it will work now. Generally I'd recommend not
starting a topic with a / unless you've got specific reasons to do so.
It is treated as an extra level of hierarchy, like

""/clid/%c/data

which makes it marginally less efficient.


Yes good recommendation, I'll put adopt this as a practice.

--
  Stefano Costa, R&D Manager
  M +39 335 6565749
  Skype stefanocosta.bluewind
  Twitter @stefanobluewind
  http://www.bluewind.it


--
Mailing list: https://launchpad.net/~mosquitto-users
Post to : mosquitto-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mosquitto-users
More help   : https://help.launchpad.net/ListHelp


Re: [Mosquitto-users] Listener / mount points and auth user

2013-09-10 Thread Stefano Costa

On 09/10/2013 02:48 PM, Roger Light wrote:

As far as I understand, defining a mount point related to a listener will
add a check: "user uid will only send/receive messages starting with
/cl/uid"

Yes, but it also changes the topic that the client sees. In your
example they do not see the /cl/uid part of the topic. If they publish
to foo, it is handled on the broker as /cl/uid/foo.


...ok I understand, it was not clear to me. I'll give this a try.



I'm not entirely sure what you're asking here I'm afraid! :) At the
moment ACL plugins tell the broker whether a particular client is
allowed access to read/write to a particular topic. It can't modify
the topic.


Ok so the answer to my question is no; I was asking myself if I can 
"manipulate" topics also, and (obviously...) no.


Thanks! S

--
  Stefano Costa, R&D Manager
  M +39 335 6565749
  Skype stefanocosta.bluewind
  Twitter @stefanobluewind
  http://www.bluewind.it


--
Mailing list: https://launchpad.net/~mosquitto-users
Post to : mosquitto-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mosquitto-users
More help   : https://help.launchpad.net/ListHelp


Re: [Mosquitto-users] mosquitto.conf and "pattern" vs "topic" (ACL)

2013-09-15 Thread Stefano Costa

Il 08/09/2013 23:25, Roger Light ha scritto:

you scrap the leading / it will work now. Generally I'd recommend not



...ok I can confirm this setup without leading slash is now working on 
existing version:



(1) mosquitto.conf: mostly default, with line added:

  acl_file /etc/mosquitto/mosquitto_acl.conf

(2) mosquitto_acl.conf content:

  topic read #

  user john
  pattern write clid/%u/data


(3) on terminal A:

  mosquitto_sub -h localhost -v -t "#"

(4) on terminal B:

  mosquitto_sub -h localhost -v -u "john" -P "john" -t "#"

(5) on terminal C:

  mosquitto_sub -h localhost -v -u "super" -P "super" -t "#"

(6) on terminal D:

  mosquitto_pub -h localhost -u "john" -t "clid/john/data" -m "99"

Result:
A -> shows message
B, C: -> does not show message


--
   Stefano Costa, R&D Manager
   M +39 335 6565749
   Skype stefanocosta.bluewind
   Twitter @stefanobluewind
   http://www.bluewind.it

--
Mailing list: https://launchpad.net/~mosquitto-users
Post to : mosquitto-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mosquitto-users
More help   : https://help.launchpad.net/ListHelp


[Mosquitto-users] Duplicate client ID

2013-12-23 Thread Stefano Costa
What are the consequences (if any) of multiple connections (maybe from 
different devices) using the same client ID?


--
  Stefano Costa, R&D Manager
  M +39 335 6565749
  Skype stefanocosta.bluewind
  Twitter @stefanobluewind
  http://www.bluewind.it


--
Mailing list: https://launchpad.net/~mosquitto-users
Post to : mosquitto-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mosquitto-users
More help   : https://help.launchpad.net/ListHelp


Re: [Mosquitto-users] Duplicate client ID

2013-12-23 Thread Stefano Costa

On 12/23/2013 10:35 AM, Nicholas O'Leary wrote:
When a client connects with an id already in use, the existing client 
will be disconnected.


Ok this sounds reasonable. Would be important that the broker does not 
behave in any other strange way, in case a duplicate ID is generated. 
Testing this situation it seems to me that everything works fine.


Thanks S



--
  Stefano Costa, R&D Manager
  M +39 335 6565749
  Skype stefanocosta.bluewind
  Twitter @stefanobluewind
  http://www.bluewind.it


--
Mailing list: https://launchpad.net/~mosquitto-users
Post to : mosquitto-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mosquitto-users
More help   : https://help.launchpad.net/ListHelp