Getting reflector access to a plugin

Posted on
Sun Dec 23, 2018 10:32 pm
Perry The Cynic offline
Posts: 758
Joined: Apr 07, 2008

Getting reflector access to a plugin

[I flipped a coin between this forum and the Reflector one...]

I find myself in the (presumably unusual) situation of needing to make TCP connections to my plugin from the wider Internet (specifically, my phone and watch and iPad while I'm away). Before I make a bespoke hack to my firewall or build my own reflector-lite, I figured I'll ask first:

Is there any way to get my reflector (that I get with my subscription...) to forward TCP channels to a running plugin? For this purpose, http framing would suffice (and automatic https: would be great). FWIW, I'm not currently using the "main" reflector channel for anything (but there seems no way to specify port numbers etc.)

Thanks (and happy holidays)
-- perry

Posted on
Mon Dec 24, 2018 11:02 am
matt (support) offline
Site Admin
User avatar
Posts: 19088
Joined: Jan 27, 2003
Location: Texas

Re: Getting reflector access to a plugin

Hi Perry,

The reflector can only reflect HTTP(s) requests to Indigo's web server port (default 8176), so it won't be very useful in this case. In the future we'll open up a way for plugins to expose some hooks via the main Indigo web server (so would still limited to HTTP requests).

The only way to do it now would be to manually create an Action Group that calls one of your plugin actions, then use the restful Indigo request to execute that Action Group. No great way to pass data to that action though, unless you make another call first to set an Indigo variable value to be the payload. Probably not what you are after though if you just want a TCP connection.

Image

Posted on
Mon Dec 24, 2018 12:47 pm
Perry The Cynic offline
Posts: 758
Joined: Apr 07, 2008

Re: Getting reflector access to a plugin

Ah well, it was worth a try.

It sure would be helpful if there was a restful API to directly call a named action on a plugin (with arguments in a json dict or such). Or did I miss one that's already there?

If you feel like exposing a stream-like link to plugins, http(s) framing is actually a pretty good way to do it. Either Indigo can act as an http proxy (between the caller and the plugin - simple Python http servers are easy), or it can terminate the https and just stream the payload to the plugin via a TCP link (both ways for a POST).

Cheers
-- perry

Posted on
Mon Dec 24, 2018 2:07 pm
RogueProeliator offline
User avatar
Posts: 2195
Joined: Nov 13, 2012
Location: Baton Rouge, LA

Re: Getting reflector access to a plugin

It sure would be helpful if there was a restful API to directly call a named action on a plugin (with arguments in a json dict or such). Or did I miss one that's already there?

If you are interested, the DomoPad plugin does this, though it isn't the most efficient process -- basically the Indigo Plugin will install/update an IWS plugin that acts as a "bridge" if you will which CAN go over the reflector. The DomoPad Android app uses this to execute plugin commands for direct control of TiVo, Roku, etc. plugin actions.

Basically the flow is:
Incoming request to the IWS plugin via HTTP, the IWS plugin in turn passes that on to the Plugin which is running a small TCP listener and the plugin action is initiated by this handler within the Indigo Plugin. Obviously this can be simplified once the full IOM is available for web but for now it is serviceable.

Adam

Posted on
Mon Dec 24, 2018 4:57 pm
Perry The Cynic offline
Posts: 758
Joined: Apr 07, 2008

Re: Getting reflector access to a plugin

RogueProeliator wrote:
It sure would be helpful if there was a restful API to directly call a named action on a plugin (with arguments in a json dict or such). Or did I miss one that's already there?

If you are interested, the DomoPad plugin does this, though it isn't the most efficient process -- basically the Indigo Plugin will install/update an IWS plugin that acts as a "bridge" if you will which CAN go over the reflector. The DomoPad Android app uses this to execute plugin commands for direct control of TiVo, Roku, etc. plugin actions.

Basically the flow is:
Incoming request to the IWS plugin via HTTP, the IWS plugin in turn passes that on to the Plugin which is running a small TCP listener and the plugin action is initiated by this handler within the Indigo Plugin. Obviously this can be simplified once the full IOM is available for web but for now it is serviceable.

Adam

Uh... that's an interesting hack. Neat.

This is one of those things that I can fix for myself with a three-line change in my firewall, but I try to write "general" plugins even when they're unpublished. You never know...

Cheers
-- perry

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 0 guests