/** * datanet-p5.js — DataNet addon library for p5.js * * Provides p5.js-friendly access to the SJS DataNet realtime pub/sub platform. * Works in both global mode and instance mode. * * Global mode: * const dn = createDataNet("ak_..."); * dn.connect(); * dn.subscribe("project.abc.temp", (data, meta) => { ... }); * * Instance mode: * new p5(function(p) { * let dn; * p.setup = function() { * dn = p.createDataNet("ak_..."); * dn.connect(); * }; * }); * * Protocol: * - Auth: POST /auth/token with {apiKey} → {token} * - WebSocket: Sec-WebSocket-Protocol: bearer, * - Envelopes: {op, ch?, d?} ops: sub | unsub | pub | hb * - Heartbeat every 30 s * - Auto-reconnect on disconnect (exponential backoff, max 5 attempts) * * Version: 0.1.0 * Platform: https://datanet.art */ (function (root, factory) { /* UMD wrapper — works as a