Getting Started
Overview
The Virtufin WebSocket Manager is a service for managing external WebSocket connections with both REST API and gRPC interfaces.
Prerequisites
- .NET 8.0 SDK or later
- Dapr CLI (optional, for local development with Dapr)
- Docker (optional, for containerized deployment)
Installation
Clone the Repository
git clone <repository-url>
cd virtufin-websockets
Build the Project
dotnet restore
dotnet build
Running the Service
Default Configuration
By default, the service runs on two separate ports: - Port 5001: HTTP (REST API, Swagger UI, health checks) - Port 5002: gRPC (native gRPC HTTP/2 h2c)
dotnet run --project src/Virtufin.WebSocketManager
Custom Port Configuration
Command-Line Arguments
# Custom HTTP and gRPC ports
dotnet run --project src/Virtufin.WebSocketManager -- --http-port 8080 --grpc-port 9090
Environment Variables
export HttpPort=4000
dotnet run --project src/Virtufin.WebSocketManager
Port Configuration Details
HTTP Port (Default: 5001)
- Uses HTTP/1.1 protocol
- Hosts REST API endpoints
- Provides Swagger UI for API documentation
- Used for health checks
gRPC Port (Default: 5002)
- Uses HTTP/2 (h2c) protocol
- Hosts native gRPC services
- Does NOT support gRPC-Web
Validation Rules
- Ports must be between 1 and 65535
- Invalid configurations will display an error message
API Access
REST API (HTTP Port)
# Health check
curl http://localhost:5001/health
# List WebSocket connections
curl http://localhost:5001/websockets
# Swagger UI
# Open http://localhost:5001/swagger in your browser
gRPC API
// C# gRPC client example
var channel = GrpcChannel.ForAddress("http://localhost:5002");
var client = new WebSocketManagerService.WebSocketManagerServiceClient(channel);
Configuration Options
Log Level Control
dotnet run --project src/Virtufin.WebSocketManager -- --log-level Debug
Available log levels: Trace, Debug, Information, Warning, Error, Critical, None
Dapr Integration
The service integrates with Dapr for: - Pub/sub messaging - State management - Service discovery
See the Dapr documentation for more information.
Full Stack Integration
The WebSocketManager is designed to work alongside the API Gateway and WorkManager. See the Cross-Service Integration Guide for a complete walkthrough covering all three services with Docker Compose and Kubernetes manifests, topic ownership, health-check sequence, and shared Dapr components.
Next Steps
- API Documentation - Complete API reference
- Architecture Overview - System design
- Deployment Guide - Production deployment
- Security - Authentication and connection ownership