A simple React application that displays an entry counter connected to a websocket. The app listens to a websocket and increments the counter whenever there is an entry event.
- Connect to Density API websocket to track space occupancy
- Display entry count with retro flip animation
- Reset button to reset the counter
- Hideable sidebar drawer to observe raw websocket events
- Space ID and API token configuration
- Node.js >= 16
- npm >= 8
- Clone the repository
- Install dependencies
npm install - Start the development server
npm start
By default, the app runs on port 3000. You can specify a different port using the standard PORT environment variable:
PORT=8080 npm start
- Enter your Space ID and API Token in the fields provided
- Click "Connect" to establish a websocket connection
- The counter will automatically increment when entries are detected
- Click "Reset" to reset the counter to zero
- Click the menu icon in the top-left to view raw websocket events
This app connects to the Density API using the following endpoint:
POST https://api.density.io/v3/analytics/ws/space/{space_id}/occupancy
with an Authorization header containing your API key.
ISC