Intial Version
This commit is contained in:
61
electron-app/README.md
Normal file
61
electron-app/README.md
Normal file
@@ -0,0 +1,61 @@
|
||||
# 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
|
||||
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
```bash
|
||||
# Start Vite dev server and Electron
|
||||
npm run electron:dev
|
||||
```
|
||||
|
||||
## Build
|
||||
|
||||
```bash
|
||||
# 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
|
||||
Reference in New Issue
Block a user