# TecnoCric localStorage realtime test

This build replaces the previous SSE network transport with a same-origin browser `localStorage` event bus while preserving the `SSEClient` API used by the existing controller and overlay themes.

## Test locally

1. Extract the project into `C:\xampp\htdocs\tecnocric`.
2. Start Apache and MySQL in XAMPP.
3. Open the auction controller at `http://localhost/tecnocric/pages/auction_controller.php?auction_id=1` (use a valid auction ID).
4. Open an overlay theme in a second tab using the same origin, for example `http://localhost/tecnocric/pages/overlay/netlify/theme/TEC-1/index.html?auction_id=1`.
5. In the controller, load a player, send player data to the live screen, place a bid, and mark a player sold/unsold.
6. Repeat with another theme tab. Each open tab on the same origin should receive the event.

## Browser console test

On the controller tab:

```js
const testBus = new SSEClient('?auction_id=1');
testBus.send({ type: 'PLAYER_DATA_FULL', player_name: 'LOCAL TEST PLAYER' });
```

On the overlay tab, listen for events:

```js
const testBus = new SSEClient('?auction_id=1');
testBus.addEventListener('message', e => console.log('LIVE EVENT:', JSON.parse(e.data)));
```

Run the listener first, then send the test event from the controller tab.

## Critical limitation

`localStorage` is isolated by origin. `http://localhost/tecnocric/...` pages can communicate with one another, but `auction.tecnocric.in` cannot share localStorage with `tecnocric.in`, a Netlify subdomain, or a different device/browser. This mode is for same-browser local testing only; it is not a production replacement for cross-device live auction updates. For production overlays hosted on a separate origin, use a same-origin proxy/relay or a server transport such as SSE.
