Configuring SignalR hubs and clients
SignalR provides a HubOptions
class to configure SignalR hubs. Also, SignalR clients have some configuration options. In this section, we will explore how to configure SignalR hubs and clients. You can find the complete code of the sample in the chapter13/v5
folder of the GitHub repository.
Configuring SignalR hubs
Here are some of the configuration options for SignalR hubs:
KeepAliveInterval
: This property determines the interval at which a keep-alive message is sent to clients. If a client does not receive a message from the server within this period of time, it will send aping
message to the server in order to maintain the connection. When changing this value, it is important to also adjust theserverTimeoutInMilliseconds
orServerTimeout
option in the client. For best results, it is recommended to set theserverTimeoutInMilliseconds
orServerTimeout
option to a value that is double the value of theKeepAliveInterval
property....