//go:build !wasm //:build !wasm // Package relayproxy is the bridge for the smesh relay-proxy worker boundary. // Two function sets in one package, used in different contexts: // // - Worker-internal (used only inside relay-proxy.wasm): // OnMessage, Post. // // - Consumer-side (used only inside app.wasm): // Send, OnMessage (consumer variant; route differs from worker variant). // // Functions called only from one context are dead-code-eliminated by the // linker for the other context, so the two function sets do not pollute // each other's wasm imports. // // Wire format on both directions: JSON-array MW-shape strings. // e.g. ["REQ","sub-1",{"kinds":[1],"limit":50},["wss://relay.damus.io"]] // e.g. ["EVENT","sub-1",{}] package relayproxy // === Consumer-side (app.wasm) === // Send dispatches a JSON-array message to the relay-proxy worker via the // supervisor. The worker decodes and acts on it. func Send(msg string) { panic("jsbridge") } // OnMessage registers a handler for messages from the relay-proxy worker. // fn receives the raw JSON-array string; the consumer parses it. func OnMessage(fn func(msg string)) { panic("jsbridge") } // === Worker-internal (relay-proxy.wasm) === // WorkerOnMessage registers a handler for inbound messages on the worker // side. JSON-array strings posted by the supervisor (originating from // app.wasm or from internal sources) are delivered here. func WorkerOnMessage(fn func(msg string)) { panic("jsbridge") } // WorkerPost sends a JSON-array message back to the supervisor over the // worker's natural postMessage channel. The supervisor forwards to app.wasm. func WorkerPost(msg string) { panic("jsbridge") } // WorkerSetTimeout schedules fn to run after ms milliseconds. Returns a // handle for WorkerClearTimeout. func WorkerSetTimeout(ms int32, fn func()) (n int32) { panic("jsbridge") } // WorkerClearTimeout cancels a pending timeout by handle. func WorkerClearTimeout(handle int32) { panic("jsbridge") } // WorkerNowSeconds returns the current Unix time in seconds via Date.now(). func WorkerNowSeconds() (n int64) { panic("jsbridge") }