An open API service indexing awesome lists of open source software.

https://github.com/adoconnection/tudasuda

C# SignalR Command/Response framework
https://github.com/adoconnection/tudasuda

Last synced: over 1 year ago
JSON representation

C# SignalR Command/Response framework

Awesome Lists containing this project

README

          

# TudaSuda
C# SignalR Command/Reply framework

Its like controllers for websockets

Imagine you call this JS code on client side:

```javascript

uplink.send({
name: 'App/Organization/Sessions/List',
data:
{
organizationGuid: $stateParams.organizationGuid
}
});

uplink.on('App/Organization/Sessions/List', function(data, commandGuid) {

$scope.sessions = data;

});

```

Process it on server like this:
```cs
[TudaSudaCommand(Route = "App/Organization/Sessions/List")]
public class List : AppCommandProcessor
{
public List(InfraredEntities entities, TudaSudaTransmitter appHubTransmitter) : base(entities, appHubTransmitter)
{
}

protected override Task Process(AppCommandArgs message)
{
Guid? organizationGuid = message?.Data?.organizationGuid;

return this.TransmitConnection(
"App/Organization/Sessions/List",
this.Entities.Sessions
.Where(s => s.OrganizationGuid == organizationGuid)
.Select(SessionFormatter.Details)
.ToList()
);
}
}
```

with just a few lines of config
```cs
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddTudaSuda();
}

public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.UseTudaSuda();
}
}
```

Isn't it great?
Now you can!