Author Topic: Alternate Connection Endpoint  (Read 348 times)

InvisibleMan1002

  • Newbie
  • *
  • Posts: 7
    • View Profile
Alternate Connection Endpoint
« on: June 22, 2016, 01:35:44 pm »
I wish to not connect my Gateway to a cloud service.
I would like to connect it to my internal REST web service.
If there anyway I can specify this?

I see I can change the MQTT server details. I guess I can create my own MQTT server instead, but would prefer just a simple mechanism to use my REST/SOAP connection.

The gateway does not show up in the Device Maintenance an Connection screen until I have an ethernet cable plugged in.  Is that normal?
Does there need to be a Network connection in order to use it?


Thank you,
Trey

Social Buttons


kristofferis

  • Sr. Member
  • ****
  • Posts: 287
  • Location: Sweden
    • View Profile
Re: Alternate Connection Endpoint
« Reply #1 on: June 22, 2016, 01:43:15 pm »
Hello.
It is not possible to connect to REST/SOAP and I really don't find any good reasons for that  :)
What I mean is when you have read about MQTT and when you have tried it then you will find it very easy and simple to use and it makes it easy to connect a lot of different system.
And then you don't want to use anything else  ;)

do you mean that you can't see it from mcStudio without network connection?
mcStudio is communicating with mcGateway over your LAN or WLAN.

InvisibleMan1002

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Alternate Connection Endpoint
« Reply #2 on: June 22, 2016, 01:58:19 pm »
Thank you for the quick reply!

I want to use an internet Web service as to not rely on the internet connectivity for my project. 
For such things as in internal project, there is no need to publish data to the internet, then have another service pull that data from MQTT and push where I need it internally.
I'm looking to create a project for Company internal use that should not care about the internet connectivity other that intranet.
I'm looking at solving this issue by using GnatMQ (https://github.com/ppatierno/gnatmq).  Hopefully I know shortly if this will work for my needs.

Ah, I did not realize mc-studio communicated to the gateway through the local network.  I had my mc-dongle plugged in to update the mc-modules and just assumed it used the mc-dongle to communicate to the mc-gateway.
So, if several of my co-workers had mc-gateways, I would also be able to communicate with theirs as well as all their mc-modules?
I see a risk in there somewhere, but not too concerning at the moment.. ( Oops, I picked the wrong gateway and the wrong modules and overwrote someone else's code. )
Is it even possible to communicate with the mc-gateway using a mc-dongle instead of Ethernet?  Not necessary, just curious.

Thank you for your time,
Trey



kristofferis

  • Sr. Member
  • ****
  • Posts: 287
  • Location: Sweden
    • View Profile
Re: Alternate Connection Endpoint
« Reply #3 on: June 22, 2016, 02:08:27 pm »
There is several open source MQTT broker that you could run in your LAN, I recommend mosquitto very simple to get it up and running.

Yes you will see all the mcGateways in your mcStudio so it's possible to select the "wrong" mcGateway and then you could send your code to the mcModules connected to that Gateway.
In later release of mcStudio, then you could name both mcGateways and mcModules and then it reduces the risk that you select the wrong one.

Ethernet is the only way to communicate between computer and mcGateway. I don't know if there is any an to change this, I don't think so.

Riverrider

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Alternate Connection Endpoint
« Reply #4 on: June 22, 2016, 05:01:23 pm »
I have had success simply publishing/subscribing via the mcGateway. No MQTT broker involved. This was described in a forum exchange somewhere but now I can't find it.

mc-John

  • Global Moderator
  • Full Member
  • *****
  • Posts: 212
    • View Profile
Re: Alternate Connection Endpoint
« Reply #5 on: June 22, 2016, 05:12:22 pm »
Quote
Ethernet is the only way to communicate between computer and mcGateway.

To be specific we communicate over UDP and TCP/IP. The UDP is required because mc-Studio needs to find gateways. After a connection is made everything goes over TCP/IP. Because UDP is involved you can only connect mc-Studio over the LAN to a gateway. We will add MQTT to mc-Studio in the future. This means that mc-Studio can connect to any gateway in the world if that gateway has a connection to the same broker.

Quote
I have had success simply publishing/subscribing via the mcGateway. No MQTT broker involved.
You can publish to any device that is connected to the same gateway and subscribed to the topic. If you want to publish to a device that is connected to another gateway you MUST use MQTT. The MQTT broker can be in the LAN or in the cloud.
« Last Edit: June 22, 2016, 05:23:47 pm by mc-John »

InvisibleMan1002

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Alternate Connection Endpoint
« Reply #6 on: June 23, 2016, 10:24:00 am »
I was able to get a GnatMQ working and test communication with it.  I've decided that this is not going to work for me.
If there is no way for a gateway to use something other than MQTT?  Yes, its great, but for this project, does not fit.
Future revision maybe?

HOST: [ http://intranet.p.org ]
URL:   [ /myservice/{topic}/{id}/{value} ]

Or we publish the URL with the message data? Then we can process the returned data?

I could write a MQTT Subscriber that listens for a published event which then takes that event and dumps into our SQL Database or I can write Arduino code that specifically sends a message to a REST service, which does what it needs to.
I was able to create something within an hour using an ESP8266 that communicated to my internal web service, saves the data it gets into a SQL database, where we can send email,s run reports, etc.
Ideally, I would want my gateway to talk directly to my web service.  Then the web service processes the data and does what is needed.
GnatMQ source is available, in theory, I could change the code in that to push the received data to a database and not worry about rebroadcasting the data out, I prefer not to do since we already have a Web Service available.

Here is a perfect example of the problems I'm talking about.
http://www.hivemq.com/blog/mqtt-sql-database

This will limit the mc-gateway from being used for certain enterprise solutions. 

Thank you,
Trey







mc-John

  • Global Moderator
  • Full Member
  • *****
  • Posts: 212
    • View Profile
Re: Alternate Connection Endpoint
« Reply #7 on: June 23, 2016, 12:28:20 pm »
Thanks for your input. We have more people that request this so we have decided to develop REST in a future revision.

-John-
Like Like x 1 View List

InvisibleMan1002

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Alternate Connection Endpoint
« Reply #8 on: June 23, 2016, 12:35:29 pm »
Awesome!
Thanks for the update.
Would you happen to have a time frame?
You need a beta tester? ;)

Thank you,
Trey

mc-John

  • Global Moderator
  • Full Member
  • *****
  • Posts: 212
    • View Profile
Re: Alternate Connection Endpoint
« Reply #9 on: June 23, 2016, 12:40:48 pm »
Great that you want to be a beta tester.
I can't give an exact timeline but I think that it is important and it is not that much work, so it will not sit in the pipeline for to long.