Skip to content

Commit

Permalink
Initial readme (OrleansContrib#2)
Browse files Browse the repository at this point in the history
* Initial Readme.md

* Basic readme
  • Loading branch information
galvesribeiro authored Nov 5, 2017
1 parent d07f2bb commit 41cd161
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 7 deletions.
65 changes: 65 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,68 @@
<p align="center">
<img src="https://github.com/dotnet/orleans/blob/gh-pages/assets/logo.png" alt="SignalR.Orleans" width="600px">
<h1>SignalR.Orleans</h1>
</p>

[![Build status](https://projectappengine.visualstudio.com/_apis/public/build/definitions/66fe6898-2b40-410a-b05d-893a610d2ccb/1/badge)](https://projectappengine.visualstudio.com/_apis/public/build/definitions/66fe6898-2b40-410a-b05d-893a610d2ccb/1/badge)
[![NuGet](https://img.shields.io/nuget/v/SignalR.Orleans.svg?style=flat)](http://www.nuget.org/profiles/SignalR.Orleans)
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/dotnet/orleans?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)

[Orleans](https://github.com/dotnet/orleans) is a framework that provides a straight-forward approach to building distributed high-scale computing applications, without the need to learn and apply complex concurrency or other scaling patterns.

[ASP.NET Core SignalR](https://github.com/aspnet/SignalR) is a new library for ASP.NET Core developers that makes it incredibly simple to add real-time web functionality to your applications. What is "real-time web" functionality? It's the ability to have your server-side code push content to the connected clients as it happens, in real-time.

**SignalR.Orleans** is a package that allow us to enhance the _real-time_ capabilities of SignalR by leveraging Orleans distributed cloud platform capabilities.


Installation
============

Installation is performed via [NuGet](https://www.nuget.org/packages/SignalR.Orleans/)

From Package Manager:

> Install-Package SignalR.Orleans -Version 1.0.0-preview-1
.Net CLI:

> dotnet add package SignalR.Orleans --version 1.0.0-preview-1
Packet:

> paket add SignalR.Orleans --version 1.0.0-preview-1

Code Examples
=============

At SignalR application configuration (`ISignalRBuilder`):

```c#
signalRBuilder.AddOrleans();
```

In your Orleans Client configuration (`ClientConfiguration`):

```c#
clientConfiguration.AddSignalR();
```

In your Orleans client builder (`IClientBuilder`):

```c#
clientBuilder.UseSignalR();
```

In your Orleans silo builder (`ISiloHostBuilder`):

```c#
siloBuilder..UseSignalR();
```

In your Orleans cluster configuration (`ClusterConfiguration`):

```c#
clusterConfiguration.AddSignalR();
```

PRs and feedback is **very** welcome!
14 changes: 7 additions & 7 deletions src/SignalR.Orleans/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,49 +12,49 @@ namespace Microsoft.Extensions.DependencyInjection
{
public static class OrleansDependencyInjectionExtensions
{
public static ClusterConfiguration AddOrleansSignalR(this ClusterConfiguration config)
public static ClusterConfiguration AddSignalR(this ClusterConfiguration config)
{
config.Globals.SerializationProviders.Add(typeof(HubMessageSerializer).GetTypeInfo());
config.AddSimpleMessageStreamProvider(Constants.STREAM_PROVIDER);
config.AddMemoryStorageProvider(Constants.STORAGE_PROVIDER);
return config;
}

public static ClientConfiguration AddOrleansSignalR(this ClientConfiguration config)
public static ClientConfiguration AddSignalR(this ClientConfiguration config)
{
config.SerializationProviders.Add(typeof(HubMessageSerializer).GetTypeInfo());
config.AddSimpleMessageStreamProvider(Constants.STREAM_PROVIDER);
return config;
}

public static ISiloHostBuilder UseOrleansSignalR(this ISiloHostBuilder builder)
public static ISiloHostBuilder UseSignalR(this ISiloHostBuilder builder)
{
return builder
.AddApplicationPartsFromReferences(typeof(ClientGrain).Assembly)
.AddApplicationPartsFromReferences(typeof(GroupGrain).Assembly);
}

public static IClientBuilder UseOrleansSignalR(this IClientBuilder builder)
public static IClientBuilder UseSignalR(this IClientBuilder builder)
{
return builder
.AddApplicationPartsFromReferences(typeof(IClientGrain).Assembly)
.AddApplicationPartsFromReferences(typeof(IGroupGrain).Assembly);
}

public static ISignalRBuilder AddOrleansSignalR(this ISignalRBuilder builder, IClientBuilder clientBuilder)
public static ISignalRBuilder AddOrleans(this ISignalRBuilder builder, IClientBuilder clientBuilder)
{
var client = clientBuilder.Build();
client.Connect().Wait();
return builder.AddOrleansSignalR(client);
}

public static ISignalRBuilder AddOrleansSignalR(this ISignalRBuilder builder, IClusterClient clusterClient)
public static ISignalRBuilder AddOrleans(this ISignalRBuilder builder, IClusterClient clusterClient)
{
builder.Services.AddSingleton(typeof(IClusterClient), clusterClient);
return builder.AddOrleansSignalR();
}

public static ISignalRBuilder AddOrleansSignalR(this ISignalRBuilder builder)
public static ISignalRBuilder AddOrleans(this ISignalRBuilder builder)
{
builder.Services.AddSingleton(typeof(HubLifetimeManager<>), typeof(OrleansHubLifetimeManager<>));
return builder;
Expand Down

0 comments on commit 41cd161

Please sign in to comment.