SignalR meets Akka.Net

Two facts for starters:
  • Actors are cool
  • Server-side events (backed by websockets) are cool

But how those cool thing would cope together?
I've decided to investigate how to organize the communication between Asp.Net backend driven by Akka.Net actors and client-side Javascript. SignalR seemed to be a pretty good choice for this task.

First and the main problem is how to map messages from Javascript client browser to the types understood by actors in the backend. Unfortunetely, SignalR doesn't work well with methods overloading. If we want to send MessageA to ActorA and MessageB to ActorB we have to either use different method names instead, or use only one method and create chain of CanDeserialize checks inside "Send". Performing lookup by switch/ifs would be ugly, so I've decided to create custom mapper, and tried to make it as much "declarative" as possible.

So to sum things up, I wanted to achieve communication using strongly typed messages.
Using a simple message mapper I have prototyped that solution here.

I wanted to achieve the same without explicit declaration of message types nor declaration of actors (let client-side decide where to send message by specifying path to the actor). And basics of how it works are explained here.

But that's not finish! Next step was to create some code, that would allow me to use Actor-like classes inside Javascript. Before that I decided to make my code more modular, rewrite it, and share it as a little bit more flexible library. And that's how I brought ActorsNet to life!

ActorsNet: Call the server-side actors within your Javascript using actor-like code&feel!

At this point the library provides an abstraction above picked actor library (currently only Akka.Net implemented though), implements communication between client and server, and provides Javascript generator that can be used to create factories of strongly-typed messages.

Source code & simple sample of use are available here.

Some documentation is provided with the code and the Github repo's readme.

Comments & any way of contribution are strongly appreciated!

Cheers!