Migration from v2.x
SignalARRR v4 is a major release with significant architectural changes. This guide covers all breaking changes and the steps to upgrade.
Target framework
v2.x: netstandard2.0v4: net10.0 (except SourceGenerator which targets netstandard2.0 per Roslyn requirements)
Update your project target frameworks:
<TargetFramework>net10.0</TargetFramework>Proxy generation
v2.x: ImpromptuInterface for runtime proxy creation v4: Roslyn source generator + optional DispatchProxy fallback
Steps
- Remove
ImpromptuInterfacepackage references - Add
Cocoar.SignalARRR.Contractsto shared interface projects - Mark interfaces with
[SignalARRRContract]:
// Before (v2.x) — no attribute needed
public interface IChatHub { ... }
// After (v4) — attribute required
[SignalARRRContract]
public interface IChatHub { ... }- If you need runtime proxy generation (plugin scenarios), add
Cocoar.SignalARRR.DynamicProxy
Authentication
v2.x: Custom IAuthenticator interface with TryAuthenticate() and SetAuthData()v4: Standard ASP.NET Core [Authorize] attributes and authentication handlers
Steps
- Remove
IAuthenticatorimplementations - Configure ASP.NET Core authentication:
builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddJwtBearer(options => { ... });- Use
[Authorize]on methods and classes instead of custom auth logic
Hub-level authorization inheritance
v2.x: Hub-level [Authorize] was disabled — ServerMethods didn't inherit it v4: Hub-level [Authorize] is inherited by all ServerMethods classes
If you had a hub with [Authorize] but relied on individual ServerMethods classes being unauthenticated, add [AllowAnonymous] to those classes:
[Authorize]
public class SecureHub : HARRR { ... }
[AllowAnonymous] // opt out of hub-level auth
public class PublicMethods : ServerMethods<SecureHub> { ... }HTTP proxy pass-through
v2.x: Available for large response streaming v4: Removed
The UseHttpResponse() option and all related code has been removed. For large data transfer, use HTTP Stream References instead — Stream parameters are automatically routed through HTTP.
Removed APIs
| Removed | Replacement |
|---|---|
ImpromptuInterface | [SignalARRRContract] + source generator |
IAuthenticator | ASP.NET Core [Authorize] |
RegisterMethods() | RegisterInterface() or typed proxies |
TryAuthenticate() / SetAuthData() | ClientContext.User / [Authorize] |
netstandard2.0 polyfill packages | Native net10.0 APIs |
Non-generic Invoke(Type, ...) overloads | Generic Invoke<T>(...) |
New packages
| Package | Purpose |
|---|---|
Cocoar.SignalARRR.Contracts | [SignalARRRContract] + source generator — add to shared projects |
Cocoar.SignalARRR.DynamicProxy | Optional runtime proxy fallback |
New features
- Source generator — compile-time proxies, AOT-friendly
- CancellationToken propagation — server can cancel client operations
- Server stream requests — server can request
IAsyncEnumerable<T>from clients StreamItemToServer/StreamCompleteToServer— client-to-server streamingClientManagertyped extensions —GetTypedMethods<T>(connectionId)for server-to-client RPC outside hub context- Authorization tests — comprehensive test coverage for auth scenarios
Next steps
- Getting Started — fresh start with v4
- Proxy Generation — source generator details
- Authorization — new authorization system