All Projects → theRainbird → CoreRemoting

theRainbird / CoreRemoting

Licence: MIT license
RPC library with classic .NET Remoting flavour

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to CoreRemoting

Sapphiredb
SapphireDb Server, a self-hosted, easy to use realtime database for Asp.Net Core and EF Core
Stars: ✭ 326 (+1317.39%)
Mutual labels:  core, websockets
Rockgo
A developing game server framework,based on Entity Component System(ECS).
Stars: ✭ 532 (+2213.04%)
Mutual labels:  websockets, rpc
Saea
SAEA.Socket is a high-performance IOCP framework TCP based on dotnet standard 2.0; Src contains its application test scenarios, such as websocket,rpc, redis driver, MVC WebAPI, lightweight message server, ultra large file transmission, etc. SAEA.Socket是一个高性能IOCP框架的 TCP,基于dotnet standard 2.0;Src中含有其应用测试场景,例如websocket、rpc、redis驱动、MVC WebAPI、轻量级消息服务器、超大文件传输等
Stars: ✭ 318 (+1282.61%)
Mutual labels:  websockets, rpc
Wsrpc
node.js/browser protobuf rpc over binary websockets
Stars: ✭ 91 (+295.65%)
Mutual labels:  websockets, rpc
Hprose Js
Hprose is a cross-language RPC. This project is Hprose 2.0 RPC for JavaScript
Stars: ✭ 133 (+478.26%)
Mutual labels:  websockets, rpc
Signalw
Even simpler and faster real-time web for ASP.NET Core.
Stars: ✭ 125 (+443.48%)
Mutual labels:  websockets, rpc
Getty
a netty like asynchronous network I/O library based on tcp/udp/websocket; a bidirectional RPC framework based on JSON/Protobuf; a microservice framework based on zookeeper/etcd
Stars: ✭ 532 (+2213.04%)
Mutual labels:  websockets, rpc
Hprose Html5
Hprose is a cross-language RPC. This project is Hprose 2.0 Client for HTML5
Stars: ✭ 237 (+930.43%)
Mutual labels:  websockets, rpc
Dotnettyrpc
A RPC Framework Based On DotNetty
Stars: ✭ 153 (+565.22%)
Mutual labels:  core, rpc
core
WIP - A personal life helper providing solutions and happiness
Stars: ✭ 17 (-26.09%)
Mutual labels:  core
live-cryptocurrency-streaming-flutter
A Flutter app with live cryptocurrency updates, powered by Ably
Stars: ✭ 26 (+13.04%)
Mutual labels:  websockets
kaspad
Kaspad is the reference full node Kaspa implementation written in Go (golang).
Stars: ✭ 81 (+252.17%)
Mutual labels:  core
mili
Team technology management tool
Stars: ✭ 22 (-4.35%)
Mutual labels:  core
wave
MQTT Broker - for IoT, DIY, pubsub applications and more
Stars: ✭ 24 (+4.35%)
Mutual labels:  websockets
Kosm-Classic-FPS-Template-UE4
Classic Arena First-Person-Shooter Mechanics for Unreal Engine 4.
Stars: ✭ 38 (+65.22%)
Mutual labels:  classic
stream video server
demonstrates how to create video streaming server with the help of aiohttp and opencv
Stars: ✭ 15 (-34.78%)
Mutual labels:  websockets
EasyUI
ESP8266 User Interface Library.
Stars: ✭ 63 (+173.91%)
Mutual labels:  websockets
my-rpc
自己编写RPC(动态代理+反射+zookeeper+netty通信),并结合Spring
Stars: ✭ 31 (+34.78%)
Mutual labels:  rpc
hospitalrun-core
All elements shared between Frontend and Backend, including CouchDB design-documents and schemas.
Stars: ✭ 36 (+56.52%)
Mutual labels:  core
arel
Lightweight browser hot reload for Python ASGI web apps
Stars: ✭ 69 (+200%)
Mutual labels:  websockets

CoreRemoting

RPC library (.NET Standard 2.0) with classic .NET Remoting flavour

NuGet package: https://www.nuget.org/packages/CoreRemoting/
Documentation: https://github.com/theRainbird/CoreRemoting/wiki

What is it for?

  • To help migrate applications that use .NET Remoting to .NET Core / .NET 5 / .NET 6.
  • To provide easy-to-use RPC functionality
  • To support events and delegates in a distributed application
  • To run on Linux, Windows and Mac

What is it NOT for?

  • To create REST-APIs for Javascript clients
  • To create SOAP Webservices
  • To use with other platforms than .NET
  • To create server applications that needs to run on several cluster nodes

Facts & features

  • Creates proxy objects for remote services at runtime (uses Castle.DynamicProxy under the hood)
  • Services can have SingleCall or Singeton lifetime
  • Uses websockets for TCP duplex network communication by default (based on webshocket-sharp)
  • Custom transport channels can be plugged in (Just implement IServerChannel and IClientChannel)
  • Used Bson serialization by default (via Json.NET)
  • Also supports classic BinaryFormatter for best possible DataSet / DataTable support
  • BinaryFormatter is hardened against known deserialization attack patterns
  • Custom serializers can be plugged in (Just implement ISerializerAdapter)
  • Support for custom authentication (Just implement IAuthenticationProvider)
  • Pluggable authentication provider to authenticate Linux user on server with PAM is available
  • Pluggable authentication provider to authenticate Windows user on server is available
  • Message encryption with RSA key exchange and AES (No SSL, no X509 certificates needed, works also on Linux)
  • Supports .NET Remoting style CallContext (also on .NET Core / .NET 5) to implicitly transfer objects on RPC calls / threads
  • Supports Microsoft Dependency Injection (Just call AddCoreRemotingServer or AddCoreRemotingClient on your IServiceCollection)
  • Supports also Castle Windsor Container to provide Dependecy Injection
  • Built-in session management
  • Automatic sweeping of inactive sessions
  • Keep session alive feature
  • Can be used in Blazor Server projects to communicate to a central application server
  • Supports Linq Expression parameters
  • Supports remote invocation of async methods (async / await)

Hello world example

Let's create a simple multi user chat server as hello world application.

Shared contract

To be able to call a remote service, the client needs to know an interface implemented by the service. This interfaces should be placed in a shared assembly (Just like it is common with .NET remoting)

namespace HelloWorld.Shared
{
    public interface ISayHelloService
    {
        event Action<string, string> MessageReceived;
        
        void Say(string name, string message);
    }
}

Server

The server side application provides services to clients.

using System;
using CoreRemoting;
using CoreRemoting.DependencyInjection;
using HelloWorld.Shared;

namespace HelloWorld.Server
{
    public class SayHelloService : ISayHelloService
    {
        // Event to notify clients when users post new chat messages
        public event Action<string, string> MessageReceived;
        
        // Call via RPC to say something in the chat 
        public void Say(string name, string message)
        {
            MessageReceived?.Invoke(name, message);
        }
    }

    public static class HelloWorldServer
    {
        static void Main(string[] args)
        {
            using var server = new RemotingServer(new ServerConfig()
            {
                HostName = "localhost",
                NetworkPort = 9090,
                RegisterServicesAction = container =>
                {
                    // Make SayHelloSevice class available for RPC calls from clients
                    container.RegisterService<ISayHelloService, SayHelloService>(ServiceLifetime.Singleton);
                }
            });
            
            server.Start();
            
            Console.WriteLine("Server is running.");
            Console.ReadLine();
        }
    }
}

Client

The client consumes remote services hosted on the server.

using System;
using CoreRemoting;
using HelloWorld.Shared;

namespace HelloWorld.Client
{
    public static class HelloWorldClient
    {
        static void Main(string[] args)
        {
            using var client = new RemotingClient(new ClientConfig()
            {
                ServerHostName = "localhost",
                ServerPort = 9090
            });
            
            client.Connect();

            // Create a proxy of the remote service, which behaves almost like a regular local object
            var proxy = client.CreateProxy<ISayHelloService>();
            
            // Receive chat messages send by other remote users by event
            proxy.MessageReceived += (senderName, message) => 
                Console.WriteLine($"\n  {senderName} says: {message}\n");
            
            Console.WriteLine("What's your name?");
            var name = Console.ReadLine();

            Console.WriteLine("\nEntered chat. Type 'quit' to leave.");

            bool quit = false;

            while (!quit)
            {
                var text = Console.ReadLine();

                if (text != null && text.Equals("quit", StringComparison.InvariantCultureIgnoreCase))
                    quit = true;
                else
                {
                    // Post a new chat message
                    proxy.Say(name, text);
                }
            }
        }
    }
}

Source code of this example is also available in the repository at https://github.com/theRainbird/CoreRemoting/tree/master/Examples/HelloWorld.

To test the hello world solution, start the server (HelloWorld.Server) and then multiple clients (HelloWorld.Client). Have fun.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].