Become a member!

DMVCFramework 3.4.3-aluminium - Official Documentation

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

Sample Description
websocket_primer Introduction to WebSocket basics
websocket_chat Multi-user chat application
websocket_groups Channel-based messaging with groups
websocket_javascript_client_sample Browser 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

Sample Description
middleware_ratelimit In-memory rate limiting
middleware_ratelimit_redis Redis-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 Case Recommended
Server-to-client only SSE (simpler)
Bidirectional communication WebSocket
Browser native support needed SSE (no JS library needed)
Binary data WebSocket
Many concurrent connections SSE (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

Version Package Folder
Delphi 13 Florence d130
Delphi 12.x Athens d120
Delphi 11.x Alexandria d110
Delphi 10.4 Sydney d104
Delphi 10.3 Rio d103
Delphi 10.2 Tokyo d102
Delphi 10.1 Berlin d101
Delphi 10 Seattle d100

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

Resource Link
GitHub Release v3.4.3-aluminium
Samples GitHub Samples
Official Guide Book Leanpub
PATREON Community Join 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

comments powered by Disqus