Become a member!

DMVCFramework 3.4.3-aluminium - Official Documentation

Archived release page. This documents an older version. For the current documentation see DelphiMVCFramework.

DMVCFramework 3.4.3-aluminium

Release Date: January 2026

This is a major release introducing WebSocket support, Rate Limiting middleware, Repository Pattern, SSE improvements and full Delphi 13 Florence support.

Download: DMVCFramework 3.4.3-aluminium on GitHub


Join the PATREON Community

PATREON Community

Get exclusive video tutorials, priority support, and early access to new features by joining the DMVCFramework PATREON community. All “Official PATRON” supporters also get access to the dedicated Discord server for direct support.


Major New Features

WebSocket Support (Server and Client)

Full WebSocket (RFC 6455) support for real-time bidirectional communication:

Server Features (TMVCWebSocketServer)

  • Event-driven architecture: OnMessage, OnClientConnect, OnClientDisconnect, OnError, OnBinaryMessage
  • Groups support: Channel-based messaging for selective broadcasting
  • Periodic messages: Automatic timed messages to clients
  • Custom client data: Store arbitrary data per connection
  • Thread-safe: All events are thread-safe for VCL/FMX updates
var
  Server: TMVCWebSocketServer;
begin
  Server := TMVCWebSocketServer.Create(9091);
  try
    Server.OnClientConnect := procedure(AClient: TWebSocketClient)
    begin
      Log('Client connected: ' + AClient.ClientID);
      AClient.JoinGroup('general');
    end;

    Server.OnMessage := procedure(AClient: TWebSocketClient; const AMessage: string)
    begin
      // Broadcast to all clients in the group
      Server.SendToGroup('general', 'User says: ' + AMessage);
    end;

    Server.Active := True;
    Writeln('WebSocket server running on ws://localhost:9091/');
    Readln;
  finally
    Server.Free;
  end;
end;

Client Features (TMVCWebSocketClient)

  • Auto-reconnect: Configurable automatic reconnection on disconnect
  • Symmetric events: OnConnect, OnDisconnect, OnTextMessage, OnBinaryMessage, OnPong, OnError
  • VCL/FMX friendly: Easy integration with desktop applications
var
  Client: TMVCWebSocketClient;
begin
  Client := TMVCWebSocketClient.Create;
  Client.AutoReconnect := True;
  Client.ReconnectInterval := 5000;

  Client.OnTextMessage := procedure(const AMessage: string)
  begin
    TThread.Queue(nil, procedure
    begin
      Memo1.Lines.Add(AMessage);
    end);
  end;

  Client.Connect('ws://localhost:9091/');
end;

WebSocket Samples

SampleDescription
websocket_primerIntroduction to WebSocket basics
websocket_chatMulti-user chat application
websocket_groupsChannel-based messaging with groups
websocket_javascript_client_sampleBrowser client example

Want more? Exclusive WebSocket video tutorials and advanced patterns are available on PATREON.


Rate Limiting Middleware

Protect your APIs from abuse with built-in rate limiting:

In-Memory Rate Limiting

Simple setup for single-server deployments:

// 100 requests per 60 seconds
Engine.AddMiddleware(
  TMVCRateLimitMiddleware.Create(
    100,  // max requests
    60,   // time window (seconds)
    'Too many requests. Please slow down.'
  )
);

Redis-Backed Rate Limiting

Distributed rate limiting for load-balanced and clustered environments:

Engine.AddMiddleware(
  TMVCRateLimitRedisMiddleware.Create(
    'redis://localhost:6379',
    100,  // max requests
    60,   // time window (seconds)
    'Rate limit exceeded'
  )
);

Features

  • Configurable limits: Requests per time window
  • Custom key extraction: Rate limit by IP, user, API key, etc.
  • HTTP headers: Returns X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset
  • 429 Too Many Requests: Standard HTTP response when limit exceeded

Rate Limiting Samples

SampleDescription
middleware_ratelimitIn-memory rate limiting
middleware_ratelimit_redisRedis-backed distributed rate limiting

Repository Pattern

Clean architecture support with IMVCRepository<T> for testable and maintainable data access:

type
  ICustomerRepository = interface
    ['{...}']
    function GetByID(const ID: Integer): TCustomer;
    function GetAll: TObjectList<TCustomer>;
    procedure Save(const Customer: TCustomer);
    procedure Delete(const ID: Integer);
  end;

  TCustomerRepository = class(TInterfacedObject, ICustomerRepository)
  public
    function GetByID(const ID: Integer): TCustomer;
    function GetAll: TObjectList<TCustomer>;
    procedure Save(const Customer: TCustomer);
    procedure Delete(const ID: Integer);
  end;

Usage with Dependency Injection

[MVCPath('/api/customers')]
TCustomerController = class(TMVCController)
private
  fRepository: ICustomerRepository;
public
  [MVCInject]
  constructor Create(Repository: ICustomerRepository); reintroduce;

  [MVCPath]
  [MVCHTTPMethod([httpGET])]
  function GetAll: TObjectList<TCustomer>;

  [MVCPath('/($id)')]
  [MVCHTTPMethod([httpGET])]
  function GetByID(const id: Integer): TCustomer;
end;

// Register in DI container
Container.RegisterType(TCustomerRepository, ICustomerRepository, TRegistrationType.SingletonPerRequest);

Benefits

  • Separation of concerns: Data access logic separated from business logic
  • Testability: Easy to mock for unit tests
  • Flexibility: Switch implementations without changing controllers
  • Works with DI: Full integration with DMVCFramework’s dependency injection container

Learn more: In-depth Repository Pattern tutorials with real-world examples available on PATREON.


Server-Sent Events (SSE) Improvements

Enhanced SSE support with the new TMVCSSEController base class for server-to-client push notifications:

type
  TMySSEController = class(TMVCSSEController)
  protected
    procedure OnClientConnected; override;
    procedure OnTick; override;
  end;

procedure TMySSEController.OnClientConnected;
begin
  inherited;
  SendEvent('welcome', 'Connected to SSE stream');
end;

procedure TMySSEController.OnTick;
begin
  inherited;
  SendEvent('heartbeat', DateTimeToStr(Now));
end;

When to use SSE vs WebSocket

Use CaseRecommended
Server-to-client onlySSE (simpler)
Bidirectional communicationWebSocket
Browser native support neededSSE (no JS library needed)
Binary dataWebSocket
Many concurrent connectionsSSE (lighter)

Expression Support in dotEnv Files

Dynamic expressions in .env configuration files using $[expression] syntax, powered by ExprEvaluator:

# Basic arithmetic
PORT=8080
DATABASE_PORT=$[PORT + 1000]
TIMEOUT_SECONDS=30
TIMEOUT_MS=$[TIMEOUT_SECONDS * 1000]

# Conditional expressions
DEBUG_LEVEL=$[IF PORT > 8000 THEN 3 ELSE 1]

# Combine with traditional ${} placeholders
HOST=localhost
DB_URL=${HOST}:$[PORT + 1000]

Supported Operations

  • Arithmetic: +, -, *, /, %
  • Comparison: >, <, >=, <=, =, <>
  • Logical: AND, OR, NOT
  • Conditional: IF ... THEN ... ELSE ...
  • String concatenation: +

IDE Wizard Improvements

  • WebSocket server generation: Create WebSocket servers from the wizard
  • Rate limiting support: Add rate limiting middleware from wizard options
  • Simplified UI: Cleaner, more intuitive interface
  • Better defaults: Improved default project configurations

Platform Support

Delphi 13 Florence

Full support for the latest Delphi version:

  • New packages for d130 (32-bit and 64-bit)
  • Updated IDE Expert
  • Compatibility fixes for new compiler features

Supported Delphi Versions

VersionPackage Folder
Delphi 13 Florenced130
Delphi 12.x Athensd120
Delphi 11.x Alexandriad110
Delphi 10.4 Sydneyd104
Delphi 10.3 Riod103
Delphi 10.2 Tokyod102
Delphi 10.1 Berlind101
Delphi 10 Seattled100

Other Improvements

Serialization Enhancements

  • Improved custom type serialization in IMVCSerializer
  • Centralized duck typing vs type serializer logic
  • Better handling of ContentType, MediaType, and Charset in JWT, Swagger, and static file middlewares

Updated Dependencies

Build System

  • Centralized dependency management for LoggerPro and SwagDoc
  • Improved package structure across all Delphi versions
  • Better release automation

Breaking Changes

None in this release. Upgrade from 3.4.2-magnesium should be seamless.


Upgrade Guide

  1. Download the new release from GitHub
  2. Update packages for your Delphi version from the packages folder
  3. Add new units if using new features:
    • WebSocket: MVCFramework.WebSocket.Server, MVCFramework.WebSocket.Client
    • Rate Limiting: MVCFramework.Middleware.RateLimit, MVCFramework.Middleware.RateLimit.Redis
    • Repository: MVCFramework.Repository
    • SSE: MVCFramework.SSEController

Resources

ResourceLink
GitHub Releasev3.4.3-aluminium
SamplesGitHub Samples
Official Guide BookLeanpub
PATREON CommunityJoin Now

Get Priority Support

PATREON Community

Join the DMVCFramework PATREON community for:

  • Exclusive video tutorials on WebSocket, Repository Pattern, and advanced topics
  • Priority support via dedicated Discord server
  • Early access to new features and beta releases
  • Direct interaction with the framework author

Join PATREON Now


← Back to DMVCFramework

Comments