Skip to content
SignalR Core support for Microsoft ASP.NET Core Blazor
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
test Update to Blazor 0.7.0 Nov 26, 2018
.editorconfig initial commit Jul 14, 2018
.gitignore
.vsts-ci.yml completed v0.1.0 Jul 15, 2018
.vsts-release.yml Updated to Blazor 0.6.0 and SignalR 1.0.4 Oct 4, 2018
Directory.Build.props
Directory.Build.targets initial commit Jul 14, 2018
LICENSE
README.md Added VSTS build badge Jul 17, 2018
SignalR.sln
global.json
package-lock.json

README.md

Build status Package Version NuGet Downloads License

Blazor Extensions

Blazor Extensions is a set of packages with the goal of adding useful features to Blazor.

Blazor Extensions SignalR

This package adds a Microsoft ASP.NET Core SignalR client library for Microsoft ASP.NET Blazor.

The package aims to mimic the C# APIs of SignalR Client as much as possible and it is developed by wrapping the TypeScript client by using Blazor's interop capabilities.

For more information about SignalR development, please check SignalR documentation.

Features

This package implements all public features of SignalR Typescript client.

Note: The Streaming APIs are not implemented yet. We will add it soon.

Sample usage

The following snippet shows how to setup the client to send and receive messages using SignalR.

var connection = new HubConnectionBuilder()
        .WithUrl("/myHub", // The hub URL. If the Hub is hosted on the server where the blazor is hosted, you can just use the relative path.
        opt =>
        {
            opt.LogLevel = SignalRLogLevel.Trace; // Client log level
            opt.Transport = HttpTransportType.WebSockets; // Which transport you want to use for this connection
        })
        .Build(); // Build the HubConnection

connection.On("Receive", this.Handle); // Subscribe to messages sent from the Hub to the "Receive" method by passing a handle (Func<object, Task>) to process messages.
await connection.StartAsync(); // Start the connection.

await connection.InvokeAsync("ServerMethod", param1, param2, paramX); // Invoke a method on the server called "ServerMethod" and pass parameters to it. 

var result = await connection.InvokeAsync<MyResult>("ServerMethod", param1, param2, paramX); // Invoke a method on the server called "ServerMethod", pass parameters to it and get the result back.

Contributions and feedback

Please feel free to use the component, open issues, fix bugs or provide feedback.

Contributors

The following people are the maintainers of the Blazor Extensions projects:

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.