Files
rmtPocketWatcher/electron-app
2025-12-03 22:49:00 -05:00
..
2025-12-03 22:04:09 -05:00
2025-12-03 18:00:10 -05:00
2025-12-03 22:40:59 -05:00
2025-12-03 20:19:40 -05:00
2025-12-03 22:40:59 -05:00
2025-12-03 22:40:59 -05:00
2025-12-03 18:00:10 -05:00
2025-12-03 22:27:29 -05:00
2025-12-03 20:19:40 -05:00
2025-12-03 18:00:10 -05:00
2025-12-03 22:49:00 -05:00

rmtPocketWatcher - Electron Desktop App

Cross-platform desktop application for tracking AUEC RMT prices in real-time.

WebSocket Implementation

The app uses a robust WebSocket client with the following features:

Main Process (src/main/)

  • websocket-client.ts: Core WebSocket client with auto-reconnect logic

    • Exponential backoff reconnection (max 10 attempts)
    • Event-based architecture for easy integration
    • Connection state management
  • ipc-handlers.ts: IPC bridge between main and renderer processes

    • Forwards WebSocket events to renderer
    • Handles renderer commands (connect/disconnect/send)
    • Auto-connects on app startup

Renderer Process (src/renderer/)

  • hooks/useWebSocket.ts: React hook for WebSocket integration
    • Manages connection status
    • Provides latest price updates
    • Exposes connect/disconnect/send methods

Shared Types (src/shared/)

  • types.ts: TypeScript interfaces shared between processes
    • PriceIndex, VendorPrice, WebSocketMessage
    • Ensures type safety across IPC boundary

Setup

npm install

Development

# Start Vite dev server and Electron
npm run electron:dev

Build

# Build for production
npm run electron:build

Environment Variables

Copy .env.example to .env and configure:

  • WS_URL: WebSocket server URL (default: ws://localhost:3000/ws)

Security

  • Context isolation enabled
  • Sandbox mode enabled
  • No remote code evaluation
  • Secure IPC communication via preload script