{"id":82,"date":"2026-02-05T11:35:42","date_gmt":"2026-02-05T11:35:42","guid":{"rendered":"https:\/\/www.myuremote.com\/website\/?page_id=82"},"modified":"2026-02-13T00:50:41","modified_gmt":"2026-02-13T00:50:41","slug":"concepts","status":"publish","type":"page","link":"https:\/\/www.myuremote.com\/website\/docs\/technical\/concepts\/","title":{"rendered":"Socket Handling"},"content":{"rendered":"\n<section style=\"max-width:1000px;margin:0 auto;padding:26px 18px;line-height:1.6;\">\n\n  <header style=\"margin-bottom:18px;\">\n    <h1 style=\"font-size:clamp(26px,4vw,38px);line-height:1.15;margin:0;\">\n      Concepts \u2013 MyURemote Core Gateway Architecture\n    <\/h1>\n    <p style=\"margin:10px 0 0 0;max-width:940px;\">\n      This page is a technical reference that explains how MyURemote works internally.\n      It is written for integrators, power users and developers who want to understand the design decisions\n      and the execution model behind MyURemote\u2019s reliability across many brands and protocols.\n    <\/p>\n    <p style=\"margin:10px 0 0 0;max-width:940px;opacity:.8;\">\n      Key idea: <strong>MyURemote is not an app that calls APIs. MyURemote <em>is<\/em> the API.<\/strong>\n    <\/p>\n  <\/header>\n\n  <hr style=\"opacity:.25;margin:18px 0;\" \/>\n\n  <!-- 1. WHAT MYUREMOTE IS -->\n  <section>\n    <h2>1. What MyURemote is in essence<\/h2>\n\n    <p>\n      MyURemote is a <strong>local socket gateway<\/strong> that turns a generic HTML\/JS user interface into a universal control system\n      for embedded devices (TVs, receivers, streamers, extenders, IR\/serial gateways, etc.).\n    <\/p>\n\n    <p>\n      The app receives requests from a WebView (HTML\/JS), translates them into <strong>byte-exact TCP communication<\/strong>\n      (or other device-specific transports), and returns results to the UI through a strict, predictable response contract.\n    <\/p>\n\n    <p style=\"margin-top:10px;\">\n      This architecture is deliberately kept simple so the UI does not need to deal with:\n    <\/p>\n    <ul>\n      <li>Firmware quirks and inconsistent protocol implementations<\/li>\n      <li>Timing issues and missing EOF markers<\/li>\n      <li>Devices that reply partially, slowly, or not at all<\/li>\n      <li>Different communication stacks (TCP, HTTP, WebSockets, IR, Serial)<\/li>\n    <\/ul>\n  <\/section>\n\n  <hr style=\"opacity:.25;margin:18px 0;\" \/>\n\n  <!-- 2. PLATFORM-INDEPENDENT CORE -->\n  <section>\n    <h2>2. The platform-independent core<\/h2>\n\n    <p>\n      MyURemote runs on iOS and Android. The code is platform-specific, but the responsibilities are identical.\n      The core is a three-part model:\n    <\/p>\n\n    <h3 style=\"margin-top:14px;\">2.1 Gateway \/ Handler (contract guardian)<\/h3>\n    <p style=\"margin:0 0 8px 0;\">\n      The Gateway\/Handler is the central coordinator between the frontend and the network layer.\n      It is responsible for enforcing the MyURemote contract.\n    <\/p>\n    <ul>\n      <li>Receiving HTTP\/JSONP requests from the WebView<\/li>\n      <li>Parsing parameters and validating intent<\/li>\n      <li>Determining whether a response is expected (based on <code>callback<\/code>)<\/li>\n      <li>Managing socket reuse (<code>keepOpen<\/code>)<\/li>\n      <li>Executing retry logic when needed<\/li>\n      <li>Returning JSONP responses that the UI can interpret deterministically<\/li>\n    <\/ul>\n    <p style=\"opacity:.8;margin-top:8px;\">\n      In short: this layer is the <strong>contract guardian<\/strong>.\n    <\/p>\n\n    <h3 style=\"margin-top:14px;\">2.2 Socket Client (network reality layer)<\/h3>\n    <p style=\"margin:0 0 8px 0;\">\n      The Socket Client implements low-level TCP communication and tolerates real-world embedded device behaviour.\n      It understands network reality, not UI assumptions.\n    <\/p>\n    <ul>\n      <li>Connect to <code>ip:port<\/code><\/li>\n      <li>Write byte-exact data<\/li>\n      <li>Read responses with real-world tolerance (no EOF, burst responses, partial data)<\/li>\n      <li>Detect connect\/write\/read failures<\/li>\n      <li>Support long-lived connections when <code>keepOpen<\/code> is enabled<\/li>\n    <\/ul>\n\n    <h3 style=\"margin-top:14px;\">2.3 Response Synchronisation (determinism bridge)<\/h3>\n    <p style=\"margin:0 0 8px 0;\">\n      The UI request cycle is synchronous by nature (HTTP request \u2192 one response),\n      while sockets are asynchronous and unpredictable. The Response Synchronisation layer bridges this gap.\n    <\/p>\n    <ul>\n      <li>Wait for bytes or a failure condition<\/li>\n      <li>Deliver <strong>exactly one<\/strong> result per request<\/li>\n      <li>Timeout enforcement<\/li>\n      <li>Byte-exact conversion to a string result for the UI contract<\/li>\n    <\/ul>\n\n    <p style=\"opacity:.8;margin-top:8px;\">\n      Without this synchronisation layer, deterministic behaviour is impossible.\n    <\/p>\n  <\/section>\n\n  <hr style=\"opacity:.25;margin:18px 0;\" \/>\n\n  <!-- 3. REQUEST CONTRACT -->\n  <section>\n    <h2>3. The MyURemote request contract<\/h2>\n\n    <p>\n      Requests are sent from the WebView to the local MyURemote HTTP endpoint (<code>\/myuremote<\/code>).\n      Parameters define both the target and the intent.\n    <\/p>\n\n    <div style=\"overflow:auto;margin-top:10px;\">\n      <table style=\"width:100%;border-collapse:collapse;min-width:740px;\">\n        <thead>\n          <tr>\n            <th style=\"text-align:left;border-bottom:1px solid rgba(0,0,0,.15);padding:10px 8px;\">Parameter<\/th>\n            <th style=\"text-align:left;border-bottom:1px solid rgba(0,0,0,.15);padding:10px 8px;\">Type<\/th>\n            <th style=\"text-align:left;border-bottom:1px solid rgba(0,0,0,.15);padding:10px 8px;\">Description<\/th>\n          <\/tr>\n        <\/thead>\n        <tbody>\n          <tr><td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\"><code>ip<\/code><\/td><td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\">string<\/td><td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\">Target device IP address<\/td><\/tr>\n          <tr><td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\"><code>port<\/code><\/td><td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\">integer<\/td><td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\">TCP port<\/td><\/tr>\n          <tr><td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\"><code>command<\/code><\/td><td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\">string<\/td><td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\">Command (URL-encoded, sent byte-exact)<\/td><\/tr>\n          <tr><td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\"><code>callback<\/code><\/td><td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\">string<\/td><td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\">JSONP callback name (defines whether a response is expected)<\/td><\/tr>\n          <tr><td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\"><code>timeout<\/code><\/td><td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\">integer<\/td><td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\">Timeout in milliseconds<\/td><\/tr>\n          <tr><td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\"><code>maxRespSize<\/code><\/td><td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\">integer<\/td><td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\">Maximum number of response bytes<\/td><\/tr>\n          <tr><td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\"><code>keepOpen<\/code><\/td><td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\">boolean<\/td><td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\">Reuse socket (ip:port) for future commands<\/td><\/tr>\n        <\/tbody>\n      <\/table>\n    <\/div>\n\n    <h3 style=\"margin-top:14px;\">Fundamental rule: response intent is explicit<\/h3>\n    <p style=\"margin:0 0 10px 0;\">\n      A response is expected <strong>if and only if<\/strong> a <code>callback<\/code> parameter is present.\n      MyURemote never guesses.\n    <\/p>\n\n    <div style=\"overflow:auto;margin-top:10px;\">\n      <table style=\"width:100%;border-collapse:collapse;min-width:680px;\">\n        <thead>\n          <tr>\n            <th style=\"text-align:left;border-bottom:1px solid rgba(0,0,0,.15);padding:10px 8px;\">Intent<\/th>\n            <th style=\"text-align:left;border-bottom:1px solid rgba(0,0,0,.15);padding:10px 8px;\">callback<\/th>\n            <th style=\"text-align:left;border-bottom:1px solid rgba(0,0,0,.15);padding:10px 8px;\">Behaviour<\/th>\n          <\/tr>\n        <\/thead>\n        <tbody>\n          <tr>\n            <td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\">Fire-and-forget<\/td>\n            <td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\">No<\/td>\n            <td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\">Send only, no read phase, returns <code>\"OK\"<\/code> immediately<\/td>\n          <\/tr>\n          <tr>\n            <td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\">Expect feedback<\/td>\n            <td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\">Yes<\/td>\n            <td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\">Full cycle: open \u2192 write \u2192 read \u2192 return result via JSONP<\/td>\n          <\/tr>\n        <\/tbody>\n      <\/table>\n    <\/div>\n\n    <p style=\"margin-top:10px;\">\n      This rule exists because MyURemote cannot know whether a device will answer:\n    <\/p>\n    <ul>\n      <li>Some devices never answer (IR blasters, many simple TCP devices)<\/li>\n      <li>Some devices answer only depending on state<\/li>\n      <li>Some devices answer partially or asynchronously<\/li>\n      <li>Many embedded devices never send EOF markers<\/li>\n    <\/ul>\n    <p style=\"opacity:.85;\">\n      Therefore: the WebView decides: <em>\u201cI want feedback\u201d<\/em> or <em>\u201cI only want to send\u201d<\/em>.\n      The decision is expressed exclusively via <code>callback<\/code>.\n    <\/p>\n  <\/section>\n\n  <hr style=\"opacity:.25;margin:18px 0;\" \/>\n\n  <!-- 4. RESPONSE CONTRACT -->\n  <section>\n    <h2>4. The MyURemote response contract (UI feedback)<\/h2>\n\n    <p>\n      The frontend interprets only a small set of fixed result strings.\n      This is a deliberate design choice to keep UI logic simple, stable, and predictable across all devices.\n    <\/p>\n\n    <div style=\"overflow:auto;margin-top:10px;\">\n      <table style=\"width:100%;border-collapse:collapse;min-width:720px;\">\n        <thead>\n          <tr>\n            <th style=\"text-align:left;border-bottom:1px solid rgba(0,0,0,.15);padding:10px 8px;\">Result<\/th>\n            <th style=\"text-align:left;border-bottom:1px solid rgba(0,0,0,.15);padding:10px 8px;\">Meaning<\/th>\n          <\/tr>\n        <\/thead>\n        <tbody>\n          <tr><td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\"><code>OK<\/code><\/td><td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\">Fire-and-forget command (no response expected)<\/td><\/tr>\n          <tr><td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\"><code>cannot connect to host<\/code><\/td><td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\">Connect\/open\/write failed<\/td><\/tr>\n          <tr><td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\"><code>no response<\/code><\/td><td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\">Write OK but device returned no response within timeout<\/td><\/tr>\n          <tr><td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\"><code>Could not write data<\/code><\/td><td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\">Legacy \/ device-specific write error<\/td><\/tr>\n          <tr><td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\"><code>error<\/code><\/td><td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\">Unexpected internal error<\/td><\/tr>\n          <tr><td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\"><em>(raw response)<\/em><\/td><td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\">Byte-exact response returned by the device<\/td><\/tr>\n        <\/tbody>\n      <\/table>\n    <\/div>\n\n    <p style=\"margin-top:10px;opacity:.85;\">\n      No other values are allowed. This strictness keeps macros, UI feedback indicators and cross-device behaviour consistent.\n    <\/p>\n  <\/section>\n\n  <hr style=\"opacity:.25;margin:18px 0;\" \/>\n\n  <!-- 5. TIMEOUT \/ READ MODEL -->\n  <section>\n    <h2>5. Timeout &#038; read model (critical)<\/h2>\n\n    <p>\n      MyURemote uses a practical two-phase read model designed for embedded devices that do not behave like clean TCP servers.\n    <\/p>\n\n    <h3 style=\"margin-top:14px;\">Phase 1 \u2013 First byte timeout<\/h3>\n    <ul>\n      <li>Timeout starts after a successful write.<\/li>\n      <li>If no byte arrives within the timeout: return <code>\"no response\"<\/code>.<\/li>\n    <\/ul>\n\n    <h3 style=\"margin-top:14px;\">Phase 2 \u2013 Idle finalize window<\/h3>\n    <ul>\n      <li>Once the response has started, MyURemote waits until the device becomes idle.<\/li>\n      <li>For non-HTTP protocols: a short idle window ends the response.<\/li>\n      <li>For HTTP: a longer idle window is used to tolerate larger payloads and chunk-like behaviour.<\/li>\n    <\/ul>\n\n    <p style=\"margin-top:10px;opacity:.85;\">\n      This model is essential for devices that:\n    <\/p>\n    <ul>\n      <li>Never send EOF markers<\/li>\n      <li>Respond slowly or in bursts<\/li>\n      <li>Send partial answers that only become complete after a short idle period<\/li>\n    <\/ul>\n\n    <pre style=\"background:#f6f7f9;border:1px solid rgba(0,0,0,.08);padding:12px;border-radius:12px;overflow:auto;\"><code>write \u2192\nwait for first byte \u2192\n  [timeout] \u2192 \"no response\"\n  [first byte] \u2192\n    collect bytes \u2192\n    idle window \u2192\n    response complete<\/code><\/pre>\n  <\/section>\n\n  <hr style=\"opacity:.25;margin:18px 0;\" \/>\n\n  <!-- 6. SOCKET CACHING & RETRY -->\n  <section>\n    <h2>6. Socket caching &#038; retry strategy<\/h2>\n\n    <p>\n      Sockets can be reused per <code>ip:port<\/code> to improve performance and reliability.\n      Reuse happens only when <code>keepOpen=true<\/code>.\n    <\/p>\n\n    <p>\n      If a \u201cbad\u201d response occurs, the socket is considered unreliable and will be dropped from cache.\n      One automatic retry is performed with a fresh connection.\n    <\/p>\n\n    <p style=\"margin-top:10px;\">\n      Bad socket responses include:\n    <\/p>\n    <ul>\n      <li><code>cannot connect to host<\/code><\/li>\n      <li><code>no response<\/code><\/li>\n      <li><code>error<\/code><\/li>\n      <li><code>Could not write data<\/code><\/li>\n    <\/ul>\n\n    <p style=\"opacity:.85;margin-top:10px;\">\n      Only sockets that behave correctly are kept and reused. This keeps the UI simple while maintaining stability.\n    <\/p>\n  <\/section>\n\n  <hr style=\"opacity:.25;margin:18px 0;\" \/>\n\n  <!-- 7. JSONP -->\n  <section>\n    <h2>7. JSONP and WebView integration<\/h2>\n\n    <p>\n      The WebView integrates via JSONP, which provides predictable callbacks even in restricted environments.\n      Responses are returned as:\n    <\/p>\n\n    <pre style=\"background:#f6f7f9;border:1px solid rgba(0,0,0,.08);padding:12px;border-radius:12px;overflow:auto;\"><code>callback({\"result\":\"...\"})<\/code><\/pre>\n\n    <p style=\"opacity:.85;margin-top:10px;\">\n      The JSONP builder ensures safe escaping and consistent output across platforms.\n    <\/p>\n  <\/section>\n\n  <hr style=\"opacity:.25;margin:18px 0;\" \/>\n\n  <!-- 8. COMPONENT MAP -->\n  <section>\n    <h2>8. Component map (iOS vs Android)<\/h2>\n\n    <div style=\"overflow:auto;margin-top:10px;\">\n      <table style=\"width:100%;border-collapse:collapse;min-width:900px;\">\n        <thead>\n          <tr>\n            <th style=\"text-align:left;border-bottom:1px solid rgba(0,0,0,.15);padding:10px 8px;\">Layer<\/th>\n            <th style=\"text-align:left;border-bottom:1px solid rgba(0,0,0,.15);padding:10px 8px;\">iOS<\/th>\n            <th style=\"text-align:left;border-bottom:1px solid rgba(0,0,0,.15);padding:10px 8px;\">Android<\/th>\n            <th style=\"text-align:left;border-bottom:1px solid rgba(0,0,0,.15);padding:10px 8px;\">Main responsibility<\/th>\n          <\/tr>\n        <\/thead>\n        <tbody>\n          <tr>\n            <td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\"><strong>Gateway \/ Handler<\/strong><\/td>\n            <td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\"><code>SocketHandler.m<\/code><\/td>\n            <td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\"><code>MyURemoteHandler.java<\/code><\/td>\n            <td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\">Contract guardian: parse parameters, decide callback behaviour, manage keepOpen, cache &#038; retry, return JSONP.<\/td>\n          <\/tr>\n          <tr>\n            <td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\"><strong>Socket client<\/strong><\/td>\n            <td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\"><code>Socket.m<\/code><\/td>\n            <td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\"><code>SimpleSocketClient.java<\/code><\/td>\n            <td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\">Low-level TCP: connect, write, read, two-phase model, error detection, byte-exact responses.<\/td>\n          <\/tr>\n          <tr>\n            <td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\"><strong>Response synchronisation<\/strong><\/td>\n            <td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\"><em>integrated in <code>Socket.m<\/code> (semaphores &#038; delegates)<\/em><\/td>\n            <td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\"><code>ResponseHandler.java<\/code><\/td>\n            <td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\">Bridge async sockets to sync HTTP lifecycle; one deterministic result per request.<\/td>\n          <\/tr>\n          <tr>\n            <td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\"><strong>Socket cache (logical)<\/strong><\/td>\n            <td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\"><code>static NSMutableDictionary&lt;NSString*, Socket*&gt; *sockets<\/code><\/td>\n            <td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\"><code>static Map&lt;String, SocketClient&gt; clients<\/code><\/td>\n            <td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\">Reuse sockets per <code>ip:port<\/code>, drop on bad responses, retry once.<\/td>\n          <\/tr>\n          <tr>\n            <td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\"><strong>JSONP builder<\/strong><\/td>\n            <td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\"><code>BuildJsonp()<\/code> in <code>SocketHandler.m<\/code><\/td>\n            <td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\"><code>buildJsonp()<\/code> in <code>MyURemoteHandler.java<\/code><\/td>\n            <td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\">Format output as <code>callback({\"result\":\"...\"})<\/code> safely.<\/td>\n          <\/tr>\n          <tr>\n            <td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\"><strong>Bad response detection<\/strong><\/td>\n            <td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\"><code>IsBadSocketResponse()<\/code><\/td>\n            <td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\"><code>isBadSocketResponse()<\/code><\/td>\n            <td style=\"padding:10px 8px;border-bottom:1px solid rgba(0,0,0,.08);\">Defines which results invalidate a cached socket.<\/td>\n          <\/tr>\n        <\/tbody>\n      <\/table>\n    <\/div>\n  <\/section>\n\n  <hr style=\"opacity:.25;margin:18px 0;\" \/>\n\n  <!-- 9. CONFIG & UI LAYER (WITHOUT \"CLOUD\") -->\n  <section>\n    <h2>9. Configuration, data storage and refresh behaviour<\/h2>\n\n    <p>\n      MyURemote is a <strong>local execution gateway<\/strong>, but configuration data is stored <strong>online<\/strong>.\n      This is a deliberate separation of responsibilities:\n    <\/p>\n\n    <ul>\n      <li><strong>Local runtime:<\/strong> commands are executed locally (gateway \u2192 sockets \u2192 devices on your LAN).<\/li>\n      <li><strong>Online configuration:<\/strong> your setup (devices, zones, macros, extenders, parameters) is stored in the database.<\/li>\n    <\/ul>\n\n    <p>\n      This has an important consequence:\n      when the frontend UI reloads or refreshes, the full configuration is pulled from the database\n      and the interface is rebuilt deterministically from that configuration.\n    <\/p>\n\n    <p style=\"opacity:.85;\">\n      In other words: MyURemote does not require a cloud to <em>execute<\/em> commands locally,\n      but it does rely on the online platform to <em>store and load configuration<\/em>.\n      Execution remains LAN-local; configuration remains centrally managed.\n    <\/p>\n  <\/section>\n\n  <hr style=\"opacity:.25;margin:18px 0;\" \/>\n\n  <!-- 10. FRONTEND EXECUTION MODEL -->\n  <section>\n    <h2>10. Frontend execution model (HTML\/JS UI)<\/h2>\n\n    <p>\n      The user interface is implemented in HTML\/JS and runs inside a WebView.\n      The UI stays device-agnostic: it does not embed vendor SDKs or protocol logic.\n      Instead it communicates with MyURemote using the request\/response contract described above.\n    <\/p>\n\n    <ul>\n      <li><strong>HTTP\/JSONP:<\/strong> generic command dispatch and deterministic results.<\/li>\n      <li><strong>WebSockets:<\/strong> supported where needed by specific device integrations.<\/li>\n      <li><strong>UI status indicators:<\/strong> the interface can show whether commands were delivered successfully or failed.<\/li>\n    <\/ul>\n\n    <p style=\"opacity:.85;\">\n      Because all low-level complexity is handled by the gateway,\n      the WebView UI can stay consistent across brands and technologies\n      while still supporting advanced setups (macros, multi-zone systems, mixed protocols).\n    <\/p>\n  <\/section>\n\n  <hr style=\"opacity:.25;margin:18px 0;\" \/>\n\n  <!-- 11. DISCOVERY \/ PAIRING -->\n  <section>\n    <h2>11. Pairing, identification and discovery<\/h2>\n\n    <p>\n      MyURemote includes functionality to simplify setup and improve reliability:\n    <\/p>\n\n    <ul>\n      <li><strong>Pairing flows<\/strong> for specific integrations that require authentication or token-based access.<\/li>\n      <li><strong>MAC address usage<\/strong> where needed to uniquely identify devices or support Wake-on-LAN scenarios.<\/li>\n      <li><strong>DLNA discovery<\/strong> to auto-detect compatible devices on the local network and prefill parameters.<\/li>\n      <li><strong>Auto-preparation:<\/strong> when a device type is known and used successfully, MyURemote can preconfigure defaults (ports, extenders, etc.).<\/li>\n    <\/ul>\n\n    <p style=\"opacity:.85;\">\n      This is part of the philosophy: configuration should be as simple as possible,\n      while runtime behaviour must remain deterministic.\n    <\/p>\n  <\/section>\n\n  <hr style=\"opacity:.25;margin:18px 0;\" \/>\n\n  <!-- 12. DEVELOPER TOOLING -->\n  <section>\n    <h2>12. Developer tooling (HTMLRemote)<\/h2>\n\n    <p>\n      For developers and integrators who want to build custom user interfaces,\n      MyURemote provides tooling and a dedicated project path.\n    <\/p>\n\n    <ul>\n      <li><strong>HTMLRemote<\/strong> is a developer-focused application to build and test custom HTML\/JS interfaces.<\/li>\n      <li>A Windows version exists for rapid development and testing.<\/li>\n      <li><strong>Note:<\/strong> the Windows developer tool supports <strong>TCP\/IP<\/strong> but does not support WebSockets.<\/li>\n    <\/ul>\n\n    <p style=\"margin-top:10px;\">\n      <a href=\"\/website\/docs\/how-to\/\" style=\"text-decoration:underline;\">\u2192 See also: How-To documentation<\/a>\n    <\/p>\n  <\/section>\n\n  <hr style=\"opacity:.25;margin:18px 0;\" \/>\n\n  <!-- 13. SUMMARY -->\n  <section>\n    <h2>13. Summary<\/h2>\n\n    <ul>\n      <li>MyURemote is a <strong>local gateway<\/strong> that translates WebView requests into byte-exact device communication.<\/li>\n      <li>The frontend declares intent explicitly using <code>callback<\/code>; the backend never guesses.<\/li>\n      <li>A strict response contract keeps UI behaviour stable across devices and protocols.<\/li>\n      <li>Timeout and read logic is designed for embedded devices that do not send EOF and reply unpredictably.<\/li>\n      <li>Execution happens locally on the LAN, while configuration is stored and loaded online.<\/li>\n    <\/ul>\n\n    <p style=\"opacity:.85;margin-top:10px;\">\n      This architecture is the reason MyURemote can scale across many brands and technologies\n      without forcing protocol complexity into the user interface.\n    <\/p>\n  <\/section>\n\n<\/section>\n\n","protected":false},"excerpt":{"rendered":"<p>Concepts \u2013 MyURemote Core Gateway Architecture This page is a technical reference that explains how MyURemote works internally. It is written for integrators, power users and developers who want to understand the design decisions and the execution model behind MyURemote\u2019s reliability across many brands and protocols. Key idea: MyURemote is not an app that calls [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":144,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-82","page","type-page","status-publish","hentry"],"blocksy_meta":{"has_hero_section":"disabled","styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":6}},"_links":{"self":[{"href":"https:\/\/www.myuremote.com\/website\/wp-json\/wp\/v2\/pages\/82","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.myuremote.com\/website\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.myuremote.com\/website\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.myuremote.com\/website\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.myuremote.com\/website\/wp-json\/wp\/v2\/comments?post=82"}],"version-history":[{"count":4,"href":"https:\/\/www.myuremote.com\/website\/wp-json\/wp\/v2\/pages\/82\/revisions"}],"predecessor-version":[{"id":143,"href":"https:\/\/www.myuremote.com\/website\/wp-json\/wp\/v2\/pages\/82\/revisions\/143"}],"up":[{"embeddable":true,"href":"https:\/\/www.myuremote.com\/website\/wp-json\/wp\/v2\/pages\/144"}],"wp:attachment":[{"href":"https:\/\/www.myuremote.com\/website\/wp-json\/wp\/v2\/media?parent=82"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}