Network TCP/IP & HTTP Controllers – MyURemote

Network TCP/IP & HTTP Controllers

MyURemote provides two generic controllers for non-secure IP-based integrations:

  • Network TCP/IP Controller → raw socket transport (ip.js)
  • Network HTTP Post-Put-Get Controller → plain HTTP builder (post.js)

These controllers define how commands are transported, not what they mean. Command semantics are defined by your device and command database.

1. Core concept

Both controllers use the same underlying MyURemote execution model:

  • Command is resolved from the device database
  • Controller builds a transport payload
  • Payload is sent to http://localhost:9090/myuremote
  • Gateway opens connection to ip:port
  • Command is written
  • Optional response is read depending on callback
The browser never connects directly to the device. The local proxy is always the transport bridge.

2. Request contract (shared)

{
  ip: "192.168.0.50",
  port: 5000,
  command: encodeURIComponent(payload),
  timeout: 60,
  keepOpen: false
}
  • callback present → MyURemote reads response
  • callback absent → fire-and-forget
  • keepOpen=true → socket reuse allowed

3. Network TCP/IP Controller (ip.js)

The TCP/IP controller sends a raw command string directly to a socket.

When to use

  • device uses plain TCP socket protocol
  • commands must be byte-exact
  • no HTTP structure required

Example command

PLAY
["PLAY"]

With parameters

INPUT
["SOURCE {0}"]

Execution:

SOURCE HDMI1

Binary command

\x02PWRON\x03

MyURemote sends bytes exactly as defined.

Key behavior

  • No HTTP headers
  • No automatic formatting
  • Full control over payload

4. Network HTTP Post-Put-Get Controller (post.js)

The HTTP controller builds a complete HTTP request from structured command definitions.

When to use

  • device exposes a plain HTTP API
  • headers and body must be constructed
  • no TLS required

Concept

Commands reference a method definition containing:

  • headers
  • content

Example

headers:
POST /api HTTP/1.1
Host: {host}
Content-Length: {length}

content:
cmd={0}

With parameter:

{0} = PLAY

Final request:

POST /api HTTP/1.1
Host: 192.168.0.50
Content-Length: 8

cmd=PLAY

Supported placeholders

  • {0}, {1}, ... → command parameters
  • {host} → extender IP
  • {port}
  • {length} → content length

5. Key differences

TCP/IP Raw socket, no structure
HTTP Full HTTP request (headers + body)

Choose based on what the device expects, not based on preference.

6. keepOpen and connection reuse

If enabled:

  • socket may be reused for same ip:port
  • performance improves
  • some devices require persistent connection

Default recommendation: keep it disabled unless needed.

7. Response handling

MyURemote returns only:

  • OK
  • cannot connect to host
  • no response
  • Could not write data
  • error
  • or raw device response
A valid response does not guarantee that the device executed the command logically.

8. Choosing the right controller

Use TCP/IP when:

  • protocol is raw socket-based
  • commands are plain or binary strings

Use HTTP when:

  • device uses HTTP endpoints
  • headers and content are required

9. Troubleshooting

  • No response → device not returning data
  • Command ignored → incorrect payload
  • Works in browser, not here → incorrect HTTP construction
  • Weird output → binary vs text mismatch

10. Summary

These controllers provide the non-secure IP transport layer of MyURemote.

They allow full control over:

  • raw TCP communication
  • plain HTTP request construction

They are fundamental building blocks for custom device integrations.