.NET

SignalR & Real-time

SignalR hubs, WebSockets, Server-Sent Events, connection management, scaling, performance

22 mülakat soruları·
Senior
1

What is a Hub in SignalR?

Cevap

A Hub is a class that serves as the central communication point between the server and connected clients. It allows invoking methods on the client side from the server and vice versa. Hubs automatically handle connection, disconnection, and message routing between connected clients. They inherit from the Hub class provided by SignalR and expose public methods that clients can call.

2

How to create a strongly-typed Hub in SignalR?

Cevap

A strongly-typed Hub inherits from Hub<T> where T is an interface defining client methods. This provides IntelliSense and type checking when calling client methods via Clients.All, Clients.Caller, etc. The interface defines the contract of methods the server can invoke on clients. This approach reduces runtime errors by catching typing issues at compile time.

3

What is the difference between Clients.All and Clients.Others in a SignalR Hub?

Cevap

Clients.All sends the message to all connected clients, including the client that triggered the call. Clients.Others excludes the calling client and only sends the message to other connected clients. Using Clients.Others is useful for scenarios like broadcasting notifications where the emitting client doesn't need to receive its own message. Clients.Caller allows sending only to the calling client.

4

How to manage groups in SignalR to send messages to a subset of clients?

5

What transports are supported by SignalR and in what order are they negotiated?

+19 mülakat soruları

Bir sonraki mülakatın için .NET'de uzmanlaş

Tüm sorulara, flashcards'a, teknik testlere, code review alıştırmalarına ve mülakat simülatörlerine eriş.

Ücretsiz başla