Skip to content

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 ports: - HTTP Port 5001: REST API endpoints and Swagger UI - gRPC Port 5002: gRPC services with plaintext HTTP/2

dotnet run --project src/Virtufin.WebSocketManager

Custom Port Configuration

Command-Line Arguments

# Custom HTTP port only (gRPC uses default 5002)
dotnet run --project src/Virtufin.WebSocketManager -- --http-port 8080

# Custom gRPC port only (HTTP uses default 5001)
dotnet run --project src/Virtufin.WebSocketManager -- --grpc-port 8081

# Both custom ports
dotnet run --project src/Virtufin.WebSocketManager -- --http-port 8080 --grpc-port 8081

Environment Variables

export HTTP_PORT=4000
export GRPC_PORT=4001
dotnet run --project src/Virtufin.WebSocketManager

Port Configuration Details

HTTP Port (Default: 5001)

  • Supports HTTP/1.1 and HTTP/2 protocols
  • Hosts REST API endpoints
  • Provides Swagger UI for API documentation
  • Used for health checks

gRPC Port (Default: 5002)

  • Supports HTTP/2 protocol only
  • Plaintext communication (no TLS required)
  • Hosts gRPC services
  • Provides gRPC reflection for client discovery

Validation Rules

  • Ports must be between 1 and 65535
  • HTTP and gRPC ports must be different
  • 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 (gRPC Port)

// 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.

Next Steps