@wailsio/runtime
    Preparing search index...

    Function JSONStream

    • A Stream that speaks objects instead of bytes.

      send(value) marshals with JSON.stringify, and ev.data in an onmessage handler is the parsed object rather than an ArrayBuffer. Pairs with StreamConn.SendJSON / ReceiveJSON on the Go side.

      const s = JSONStream("telemetry");
      s.onmessage = (ev) => console.log(ev.data.temperature);
      s.onopen = () => s.send({ subscribe: "sensors" });

      A frame that is not valid JSON raises an error event and is dropped, rather than throwing from the poll loop and taking the connection down with it.

      Parameters

      • name: string

      Returns JSONSocket