Anyone ever used ngrok?

Posted on
Sun Oct 28, 2018 4:25 pm
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Anyone ever used ngrok?

Seems like every time I look at the tutorials for using some sort of Web API, they use ngrok and flask (if it's a Python app) to show you how to do it. That's because most of the Web APIs out there do callbacks to a server for authentication and asynchronous notifications. And you're generally not going to spin up a public Internet facing server for early development use.

It sure would be handy to have an accessible web server in an Indigo plugin. Twilio could sure use one. And I've been looking at Slack as well, since the existing (abandoned) plugin doesn't work any more. But I'm not sure if the majority of the Indigo user base would want to install and configure ngrok on their system.

I'm wondering if I could embed ngrok in a plugin and then make it available to other plugins via some sort of inter-plugin API.

Thoughts?

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Mon Oct 29, 2018 10:16 am
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Anyone ever used ngrok?

Interesting. I've never run across an API that required a connection back for authentication - that seems somewhat counter intuitive.

Flask is a Python web app framework (like django but somewhat lighter and like cherrypy but somewhat heavier). I've never heard of ngrok, but a brief glance at it looks like it's very similar to our reflector server in terms of what it does: creates secure tunnels from their hosted site to your "server" and then redirects HTTP traffic over it.

One way to do similar is to build an IWS plugin which would communicate through IWS (and over the reflector). We generally don't encourage people to build those (they will most likely break in a future version of IWS that's built on top of the IOM), but in a few cases it's useful (I believe Adam built one for DomoPad for instance).

Note to Matt: you and Andy should have filed a patent years ago when you built the reflector - those guys would owe you a mint!

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Mon Oct 29, 2018 10:27 am
RogueProeliator offline
User avatar
Posts: 2501
Joined: Nov 13, 2012
Location: Baton Rouge, LA

Re: Anyone ever used ngrok?

One way to do similar is to build an IWS plugin which would communicate through IWS (and over the reflector). We generally don't encourage people to build those (they will most likely break in a future version of IWS that's built on top of the IOM), but in a few cases it's useful (I believe Adam built one for DomoPad for instance).

Yup, I created a small web service handler to support the features that I added which were not supported by the standard command interface available for clients... in my case it is built so that it may easily be transformed if/when the IWS model is upgraded to support the IOM.

Jon, my model isn't going to scale terribly well as it basically requires that an IWS plugin pass the request along to the Python plugin which is acting as a web server. However, scale isn't a huge issue for most HA operations at the plugin level. You are welcome to browse the source to see if that method would work for you as it is pretty darn simple to create -- no installation required on the user's end.

Look towards the bottom for the ThreadedTCPRequestHandler.
https://github.com/RogueProeliator/Domo ... /plugin.py

Adam

Posted on
Mon Oct 29, 2018 12:43 pm
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Anyone ever used ngrok?

jay (support) wrote:
Interesting. I've never run across an API that required a connection back for authentication - that seems somewhat counter intuitive.


That sure seems to be the way that Slack wants to work. I need to go through the tutorials step by step, but as far as I can tell it's designed to web-server to slack-server communication, where the slack server does callbacks to the public web server for a bunch of things. I'll report again when I get through the tutorials.

But even ignoring the authentication step, there are other instances like this. For example, most of the fancier things you can do with Twilio require that it reach out to a sever somewhere to get resources. Like if you want to send a file attachment via MMS, you can only provide a URL to that file when you make the call to Twilio. It'll grab the file when it's ready for it. So to send security camera pictures via my Twilio plugin, I first need to upload the images to a web server somewhere. That's why my FTP plugin was developed.

jay (support) wrote:
Flask is a Python web app framework (like django but somewhat lighter and like cherrypy but somewhat heavier). I've never heard of ngrok, but a brief glance at it looks like it's very similar to our reflector server in terms of what it does: creates secure tunnels from their hosted site to your "server" and then redirects HTTP traffic over it.


Is there a way to serve up random files via http using the reflector? Having to be in a specific Indigo directory would be OK.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Mon Oct 29, 2018 8:06 pm
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Anyone ever used ngrok?


Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Mon Oct 29, 2018 8:35 pm
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Anyone ever used ngrok?

jay (support) wrote:
https://forums.indigodomo.com/viewtopic.php?f=131&t=20640&p=159872#p159872


Thanks. Is there a server variable or property with the name of the reflector?

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Tue Oct 30, 2018 9:09 am
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Anyone ever used ngrok?

No, but I'll add it to the feature request list.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri Jun 18, 2021 2:56 pm
matt (support) offline
Site Admin
User avatar
Posts: 21411
Joined: Jan 27, 2003
Location: Texas

Re: Anyone ever used ngrok?

Indigo 2021.1.0 is now available and includes access to the full reflector URL via the API:

Code: Select all
indigo.server.getReflectorURL()

Image

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 11 guests