You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

Blazor.ConnectionStatusDetector

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Blazor.ConnectionStatusDetector

This package provides the ConnectionStatusDetectorService that provides the ConnectionStatusChanged event that notifies changes in the connection status on the client side. Apart from the event, the service has a property to query the connection status. In addition, the Connection component is provided which renders different fragments depending on the connection status.

1.0.1
nugetNuGet
Version published
Maintainers
1
Created
Source

NuGet

Blazor.ConnectionStatusDetector

This package provides the ConnectionStatusDetectorService that provides the ConnectionStatusChanged event that notifies changes in the connection status on the client side. Apart from the event, the service has the property IsOnline to query the connection status.

In addition, the Connection component is provided which renders different fragments depending on the connection status.

Add the package to your project:

dotnet add package Blazor.ConnectionStatusDetector --version 1.0.0

To use it, link to connection.js in your index.html file:

<script src="_content/Blazor.ConnectionStatusDetector/connection.js"></script>

Then register the service in yout Program.cs:

services.AddSingleton<IConnectionStatusDetectorService, ConnectionStatusDetectorService>();

To render different fragments based on the connection status, import the namespace in you _Imports.razor file:

@using Blazor.ConnectionStatusDetector

add a Connection component in your razor files, like:

<Connection>
    <Online>
        <h1 style="color: green">Online</h1>
    </Online>
    <Offline>
        <h1 style="color: red">Offline</h1>
    </Offline>
</Connection>

Keywords

blazor

FAQs

Package last updated on 04 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts