Asp.Net MVC + SignalR meets Actors!
Call the sever-side actors within your javascript. Initialize your actor system and done!
Abstraction layer over actor system or framework.
Concrete implementation for ActorsNet classes using Akka.Net
Module that allows async calls between server and client.
Generates factories for creating strongly typed messages (possibility to save generated js and use it for code completion instead of writing message type names by hand).
Projects that contains initializer classes that can be used with Autofac IoC.
Example application, contains actor system creation code, initializers and example calls.
Contains script for creating ActorSystem proxy on the client-side and call server-side actors [actorsnet.js]
Change app.js to test communication with hand-written messages or generated ones.
public class EchoActor : ReceiveActor
{
public EchoActor()
{
Receive<Echo>(echo =>Sender.Tell(echo, Self));
}
}
public class Echo
{
public Echo(string message)
{
Message = message;
}
public string Message { get; private set; }
}
//if Javascript generator is used
builder.RegisterJavascriptGenerator(new MessagesBySystemNameProvider()
.Add<Echo>(ActorSystemName)
.Add<Greet>(ActorSystemName));
builder.RegisterActorSystem(actorSystem);
(function() {
var actorSystem = new ActorsNetSystem("MySystem");
actorSystem
.open()
.then(function() { //system ready
var echoActor = actorSystem.actorFor("/echo");
var echoMsg = actorSystem.createMessage("ActorsNet.Web.Messages.Echo");
echoMsg.setMessageData({ Message: "SignalR ask test" });
//send message
echoActor.send(echoMsg);
//or ask and wait for response
echoActor
.ask(echoMsg)
.then(function(response) {
alert(response);
});
});
})();
(function() {
var mySystem = ActorsNet.MySystem.create();
mySystem
.open()
.then(function() {
var echoActor = mySystem.actorFor("/echo");
var echoMessage = ActorsNet.MySystem.ActorsNet_Web_Messages_Echo.create();
echoMessage.setMessageData({ Message: "Eccchoooo!" });
//send message
echoActor.send(echoMessage);
//or ask and wait for response
echoActor
.ask(echoMessage)
.then(function(response) {
alert(response);
});
});
})();
- Add more tests
- Make nuget packages
- Implement and test different Akka.Net ActorFinder strategies (akka.tcp/cluster)
- Integration with client side actors library (https://github.com/mental/webactors ?) to allow communication between JS actors
- Implementation of a server side router actor to allow calls from server to client-side declared actors (Actorish-WebWorkers)
- Different implementation of ActorSystem (Microsoft Orleans)