Giter Club home page Giter Club logo

replicate's Introduction

Replicate

A simple abstraction for network programming in C#. Replicate provides a simple yet powerful RPC framework that operates on top of a simple, customizable network abstraction. This is what an echo server/client looks like:

[ReplicateType]
public interface IEchoService
{
    Task<string> Echo(string message);
}
public class EchoService : IEchoService
{
    public async Task<string> Echo(string message)
    {
        await Task.Delay(100); // Do some work
        return message + " DONE";
    }
}
public async Task EchoExample()
{
    // Server side
    var server = new RPCServer();
    server.RegisterSingleton<IEchoService>(new EchoService());
    SocketChannel.Listen(server, 55555, new BinarySerializer());
    // Client side
    var clientChannel = SocketChannel.Connect("127.0.0.1", 55555, new BinarySerializer());
    var echoService = clientChannel.CreateProxy<IEchoService>();
    Assert.AreEqual("Hello! DONE", await echoService.Echo("Hello!"));
}

Everything is code

Replicate translates networking complexity into programming concepts. Instead of writing/implementing APIs, you use interfaces. Instead of send/receiving messages, or making requests, you call functions.

When writing a server application, the first step is to create an interface like IEchoService above. Then the server needs an implementation of this interface, in this case EchoService. Finally create an RPCServer, register the service, and begin listening.

The client side needs only to connect to the same host/port and create a proxy for the service. All of the methods in this proxy are magically implemented with client stubs that call out to the network and wait for a response.

replicate's People

Contributors

alex-sherman avatar

Stargazers

 avatar GAURAV avatar Alex Larioza avatar

Watchers

James Cloos avatar  avatar Chris Pickels avatar  avatar

replicate's Issues

Distributed owners for objects

Some objects may be owned by the collection of peers participating in replication, for instance game state or connection state (a mapping of application client IDs like GUIDs to the auto assigned ReplicateIDs).

Must be able to persist objects like these across replication groups.

Maybe also supports objects with no owner?

Replication Relevance

Support a mechanism to allow replication participants to decide which peers are relevant to objects they own.

Support white and black lists?

Custom Serializers

Support custom serializers other than the default binary serializer, for instance JSON.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.