ChainSafe / ChainSafe/open-creator-rails.unity
WebSocket (or indexer) support for event subscription instead of RPC-only polling
- Dominant language
- C#
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
**What**
Add real-time or near-real-time event subscription for updating OCR-related data in Unity, instead of relying solely on RPC polling. Nethereum.Unity does not expose `Nethereum.RPC.Reactive`, so today we are limited to polling patterns.
**Why**
Polling is costly, slower to converge, and harder to scale for many assets or frequent updates. WebSocket subscriptions (or an indexer-backed alternative) reduce RPC load and improve UX for live state such as subscriptions, access, and asset metadata.
**How**
* Evaluate two implementation paths (may combine):
* **Path A:** Compile or vendor `Nethereum.RPC.Reactive` (or equivalent reactive/WebSocket client pieces) independently and ship a compatible DLL inside the OpenUPM package, wired to Unity’s supported .NET profile.
* **Path B:** Implement a dedicated WebSocket client path for JSON-RPC subscriptions (`eth_subscribe` / logs / new heads as applicable) without full Nethereum.Reactive, matching our minimum event needs.
* **Indexer-first preference:** Prefer relying on the indexer for updates when it is cheaper and sufficient:
* If the indexer exposes WebSocket (or SSE) for event or entity updates, integrate that for push-based refresh.
* If not, use indexer HTTP APIs with bounded polling/refresh intervals instead of heavy node polling.
* Define clear fallbacks: indexer push → indexer poll → node WebSocket → node poll (document order and when each is used).
* Ensure lifecycle safety in Unity (connect/reconnect, scene unload, `DontDestroyOnLoad` services).
* Document configuration (endpoints, auth if any), rate limits, and operational trade-offs for package consumers.
**Acceptance Criteria**
* Unity package can subscribe to updates via at least one non-polling path where the deployment supports it (WebSocket to node and/or indexer push).
* When push is unavailable, documented indexer-backed polling strategy is used with sensible defaults.
* OpenUPM package remains buildable and documents any extra native/DLL constraints.
* Clear comparison vs current RPC-only polling: when to use which path.
* Basic tests or manual verification checklist for connect, event delivery, and reconnection.
**Estimation**
**Dependencies**
None
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by mapping the existing Unity OCR/indexer and RPC polling entry points, then compare Nethereum.RPC.Reactive with a dedicated eth_subscribe path and the indexer HTTP or push APIs. Define the fallback order, Unity lifecycle behavior, configuration, and package constraints before implementation. Done means a supported non-polling path, documented polling fallback, buildable OpenUPM packaging, and connection, delivery, and reconnection verification.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, unity
- Domain
- api, game-dev, networking
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100