A Node.js application that monitors active Formant sessions and displays connected devices and users. This tool uses Formant's gRPC and REST APIs to provide real-time information about peer connections in your Formant deployment.
- Authenticates with Formant using email/password
- Retrieves all active peer connections
- Groups connections by session ID
- Displays detailed information about connected devices and users
- Shows real names and email addresses of connected users
- Shows device names and IDs
- Handles multiple peers per session
- Node.js - Runtime environment
- TypeScript - Programming language
- gRPC - Remote Procedure Call framework
- Protocol Buffers - Data serialization format
- @grpc/grpc-js - gRPC implementation for Node.js
- dotenv - Environment variable management
- ts-node - TypeScript execution environment
- Node.js (v14 or higher)
- npm or yarn
- A Formant account with valid credentials
- Access to Formant devices
-
Clone the repository:
git clone [email protected]:FormantIO/session-monitor.git cd formant-session-monitor
-
Install dependencies:
npm install # or yarn install
-
Create a .env file in the root directory:
FORMANT_EMAIL=[email protected] FORMANT_PASSWORD=your-password
Run the application:
npm start
# or
yarn start
The application will:
- Authenticate with Formant
- Retrieve all active peer connections
- Group them by session
- Display information about each session's connected peers
Example output:
Active Sessions:
---------------
Session: session-id-1
Connected Peers:
Device: Robot-1 (device-id-123)
User: John Smith (user-id-456)
---------------
Session: session-id-2
Connected Peers:
Device: Robot-2 (device-id-789)
User: Jane Doe (user-id-012)
---------------
src/
formant-client.ts
- Main client implementation for Formant API interactionsprotos/
- Protocol Buffer definitions
app.ts
- Application entry point.env
- Environment configurationpackage.json
- Project dependencies and scripts
The application integrates with multiple Formant APIs:
- Signaling service for peer information
- Real-time session monitoring
- Authentication (
/v1/admin/auth/login
) - Device information (
/v1/admin/devices/{id}
) - User information (
/v1/admin/users/{id}
)
If you need to rebuild the Protocol Buffer definitions:
npm run build:protos
# or
yarn build:protos
FORMANT_EMAIL
- Your Formant account emailFORMANT_PASSWORD
- Your Formant account password
Common issues and solutions:
-
Authentication Failures
- Verify credentials in .env file
- Check account permissions
- Ensure protos are built
-
Network Issues
- Verify internet connectivity
- Check firewall settings
-
Missing Information
- Verify device/user permissions
- Check API access rights