Giter Site home page Giter Site logo

rsocket-net's Introduction

RSocket Protocol

RSocket is an application protocol providing Reactive Streams semantics over an asynchronous, binary boundary.

It enables the following symmetric interaction models via async message passing over a single connection:

  • request/response (stream of 1)
  • request/stream (finite/infinite stream of many)
  • fire-and-forget (no response)
  • channel (bi-directional streams)

It also supports connection resumption to allow resuming long-lived streams across different transport connections. This is particularly useful for mobile<->server communication when network connections drop, switch, and reconnect frequently.

Artifacts include:

More information and links to various implementations can be found at http://rsocket.io

Bugs and Feedback

For bugs, questions and discussions please use the Github Issues.

LICENSE

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

rsocket-net's People

Contributors

aboccag avatar dbarnett-netifi avatar giorgi avatar kbahr avatar kumareshan009 avatar olegdokuka avatar rdegnan avatar robertroeser avatar tpeczek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rsocket-net's Issues

SocketTransport requires a server version

The SocketTransport is configured as a 'client' socket with no specific bind and / or listen so although it exists it doesn't appear possible to actually connect to anything.

Is this work in progress or is there a specific usage pattern than I am missing ? It seems that each separate service would require a 'server' SocketTransport to handle incoming connections and then this existing implementation to call out to other services.

Thanks for any help, fingers crossed the project hasn't ground to a halt

RSocket support for Unity3D

As for now, it seems not to be possible to use rsocket-net from inside Unity3D project.
RSocket seems like an ideal solution for some kind of multiplayer games (turn-based, some casual networking games). Game DEV industry might be an area for potential growth and adoption.

Motivation

I created a multiplayer, turned-based game for Android and so I tried to use RSocket as it seemed the most appropriate solution for my needs. I tried gRPC, Websockets, SocketIO etc. and ended up with SocketIO, but I still regret not investing time for making RSocket.NET run on my project somehow.

Desired solution

It would be great if the library would be supported for all platform like WebGL, Android, IOS, consoles, PC.
I know RSocket is transport-transparent by design and it would make potential rsocket-unity3d project easier to implement (ie. WebGL supports only Websockets). The more significant problem (potentially) would be to make it Android compatible (AOT issues).
So, in a nutshell, the desired solution would be to create a separate project that would use only Unity3D compatible libraries and would support both Android and WebGL (as AFAIK only these platforms cause problems).

Considered alternatives

I am not sure, but it may be possible to modify rsocket-net project so that it could be ran on Unity3D.

digital signature needed for RSocket.core.dll

@OlegDokuka currently version 0.2.3 is not digitally signed.

Based on discussion done with Reetesh Agarwal's, we were expecting the digitally signed versions to be available in some time .

Any idea when we can expect the package to be signed with valid certificates.

Missing interfaces and class in DotNet RSocket.Core Nuget package version 1.0.0

@OlegDokuka , we observed that a new version 1.0.0 was available from nuget on 23rd july 2020
It was observed that few classes and interface available in 0.2.3 are not available in the new version
For ex: IRSocketChannel and RSocketOptions are not longer available

Expected Behavior

From yesterdays code merge and discussion done with Reetesh Agarwal's team ,we were expecting that the same changes would be available related to PR #11

Actual Behavior

Some of the interfaces and classes are no longer available and code seems to contain few different method and classes.
Please confirm if its from the same source and 1.0.0 is the intended version to be used.

Attaching a comparison screen shot for reference:
image

Project Status

Would you please consider resurrecting this project and give the (relatively speaking) new .NET Core ecosystem another chance?

I might be late to the party, but rsocket sounds very interesting, especially for people like me looking for new ways to solve recurring problems with better tools.

There’s a month-old PR by @davidfowl that went unnoticed.

I think that was a missed opportunity.

For anyone else lurking here, any “rsocket equivalent” tech you’d recommend for .NET Core 3?

Thanks

Logging is slowing down execution

The logging on every call takes a lot of time. Doing 10,000 request responses of static text "OK" takes 1.8426/ms per request which is abysmal for a 2 byte package. I see no clear options to disable this. If there is already a way to disable please let me know.

Expected Behavior

Ability to turn off logging

Actual Behavior

No ability to turn off logging (that I can see)

Steps to Reproduce

Follow the demo project, echo OK for 10,000 iterations

@Test
public void reproCase() {

}

Possible Solution

Provide ability to disable logging

Your Environment

  • RSocket version(s) used:
  • Other relevant libraries versions (eg. netty, ...):
  • Platform (eg. JVM version (javar -version) or Node version (node --version)):
  • OS and version (eg uname -a):

Issue with RSocketProtocol.Handler reading loop

while (!cancellation.IsCancellationRequested)
{
var read = await pipereader.ReadAsync(cancellation);
var buffer = read.Buffer;
if (buffer.IsEmpty && read.IsCompleted) { break; }
var position = buffer.Start;
//Due to the nature of Pipelines as simple binary pipes, all Transport adapters assemble a standard message frame whether or not the underlying transport signals length, EoM, etc.
var (Length, IsEndOfMessage) = MessageFramePeek(buffer);
if (buffer.Length < Length + MESSAGEFRAMESIZE) { pipereader.AdvanceTo(buffer.Start, buffer.End); continue; } //Don't have a complete message yet. Tell the pipe that we've evaluated up to the current buffer end, but cannot yet consume it.
await Process(Length, buffer.Slice(position = buffer.GetPosition(MESSAGEFRAMESIZE, position), Length));
pipereader.AdvanceTo(position = buffer.GetPosition(Length, position));
//TODO UNIT TEST- this should work now too!!! Need to evaluate if there is more than one packet in the pipe including edges like part of the length bytes are there but not all.
}

Doesn't properly handle the exit condition and could result in an infinite loop if partial data is sent and the read is completed.

See https://github.com/davidfowl/DocsStaging/blob/master/Pipelines.md#code-samples for more information.

RequestStream messages are truncated usually after the 1st message frame

Per this SO for a net client (with either binary or string data encoding) the 1st message is received and treated properly and usually the 2nd but from then on messages are truncated. This causes a crash at RSocketProtocol.Handler.cs where the header type is unknown and therefore not handled.

To replicate the error start a Java spring boot RSocket server. Then spin up a net client with code like this:

var client = new RSocketClient(new WebSocketTransport("ws://127.0.0.1:7000/"));

Console.WriteLine("Connect Async");
await client.ConnectAsync(new RSocketOptions()
{ 
  DataMimeType = "application/json",
  MetadataMimeType = "message/x.rsocket.routing.v0"
});

Console.WriteLine("Requesting Raw Stream...");

string json = "{\"StartServerStream\":\"Y\"}";

string route = "quotes";
byte[] intBytes = BitConverter.GetBytes(6);
string stringBytes = Encoding.Default.GetString(intBytes, 0, 1);
string metaData = stringBytes + route;

var stringclient = new RSocketClient.ForStrings(client);
await stringclient.RequestStream(json, metaData)
    .ForEachAsync((result) =>
    {
        Console.WriteLine($"Result ===> {result}");
    }); 

The server uses webflux to stream back to the client. Get the RSocket.Core and put a breakpoint at https://github.com/rsocket/rsocket-net/blob/master/RSocket.Core/RSocketProtocol.Handler.cs#L30

If you watch the message sizes coming in, the 1st message size is what you expect from your server (fielding dummy messages) but the next message sizes are unexpected.

Integration with Java Server

Hello,

I'm having difficulty to figure out the project as its lacking more sample on connecting client to remote server.
For instance, .net client that will connect to java server.

Can i ask for other sample ?
image

Nuget listing issue, is package deprecated ?

While I was looking implementation in C# using RSocket.Core, package was listing on Nuget. But today i see "The owner has unlisted this package. This could mean that the package is deprecated or shouldn't be used anymore" message.

What is the feature of this package ? Should i wait for a new version or not consider this solution for RSocket .Net implementation ?

Work in progress?

Is this being worked on? With the new System.IO.Pipelines API this would be fantastic for .NET Core microservices.

If nobody's working on it I might have a hack at it.

RSocket client is not sending a Hearbeat packet to the server.

On setting up the RSocket connection with options ( 10 seconds KeepAlive and 180 seconds LifeTime) the connection is getting closed on the .NET client side as server is not receiving any heartbeat messages.
The issue is not replicated in Java RSocket client Library.

image

@OlegDokuka Can you please look into this with priority as we are blocked because of this issue.

RSocketSample: need sample for use of SocketTransport & WebSocketTransport

Hi RSocket Team,

I am trying to create a very simple RSocketServer using .NET 5. I have seen the sample project RSocketSample and tried to replace LoopbackTransport with SocketTransport or WebSocketTransport. I have used .NET 5 worker template and put this logic to separate hosted service. But it does not work. Sample with SocketTransport falls at Server.ConnectAsync(), but WebSocketTransport sample starts normally. However, I cannot connect it through WebSocket - Chrome says "WebSocket connection failed" when I try to do let ws = new WebSocket('ws://localhost:59800') (I am using this port in server app). Could you please add samples of SocketTransport & WebSocketTransport use?

Thanks,
Alex

RSocketSample

  1. rsocket-net/RSocketSample/Program.cs is not working

strong name signing needed for version 0.2.3

Motivation

Strong name signing will encourage more users to use the RSocket core library so that it can be used by projects which use strong name signing

Desired solution

Create a strong name key and sign the RSocket core dll

Considered alternatives

Tried signing locally but due to virality of strong name signing it requires properly signed dlls.

Additional context

Steps:

  1. Generating the strong name file using visual studio 2017 cmd prompt and sn tool:
    sn -k RSocketStrongName.snk

image

  1. Enabling strong name signing via visual studio: In project properties use signing , refer below screen shot for reference.
    image

  2. Verification of the signature: sn -v RSocket.Core.dll
    image

Payload truncated in RequestResponse

During the RSocketClient initialisation, I have defined the Responder as Follows:

public async ValueTask<(ReadOnlySequence Data, ReadOnlySequence Metadata)> RequestReponseListner((ReadOnlySequence data, ReadOnlySequence metadata) value)

What i observe is that, the data gets truncated beyond ~1800 bytes.

RSocket client route

Hello :)

I would like to know how to route to a specific message mapping using routes.

I have a spring boot server using RSocket over tcp and this code

server.port=8080
spring.rsocket.server.port=8081
spring.rsocket.server.transport=tcp

@MessageMapping("feedMarketData")
public Flux<MarketData> feedMarketData(MarketDataRequest marketDataRequest) {
    return marketDataRepository.getAll(marketDataRequest.getStock());
}

I Would like to make a .NET request routing to feedMarketData

Thanks for your help !

IRSocketProtocol.Error is not implemented (mentioned as a TODO)

Currently in the RSocket Library we don't have a mechanism to handle errors coming from server.
I also observed that the observer is not being removed from the Dispatcher map used internally.
This will increase memory over time is my belief.
The streamId used to push to Dispatcher map is also int and will overflow over time and should fail in the long run. Correct me if I am wrong on this.
I have copied the screenshots below for reference,

Screen Shot 2020-08-13 at 5 51 40 PM

Screen Shot 2020-08-13 at 5 54 33 PM

Screen Shot 2020-08-13 at 6 16 27 PM

Expected Behavior

We should get the OnError callback for System.IObserver<(System.Buffers.ReadOnlySequence metadata, System.Buffers.ReadOnlySequence data)> object that is passed in our case RequestReponse function.
The object must be disposed from the Dispatcher map once there is no further reference to it.
We must reuse streamid so that it will work infinitely.

Actual Behavior

No callback in case of an error from the server

Steps to Reproduce

1.Send a RequestResponse to a server and let the server respond back with some error
@test
public void reproCase() {

}


## Possible Solution
<!--- Not obligatory, but you can suggest a fix/reason for the bug. -->

## Your Environment
<!--- Include as many relevant details about the environment you experienced the bug in. -->
<!--- Especially, always include the version(s) of RSocket library/libraries you used! -->

* RSocket version(s) used:
* Other relevant libraries versions (eg. `netty`, ...):
* Platform (eg. JVM version (`javar -version`) or Node version (`node --version`)):
* OS and version (eg `uname -a`):

Secure connections over TCP

Does this library support secure (tls) connections over the TCP connections? For WebSockets it works by using wss scheme URL but what about tcp?

Improperly formed default mime type causes connection error when connecting to spring-boot rsocket server

Hi everyone,

I have a Spring Boot RSocket server and I am unable to connect to it with your example. I got a rejected Setup :
0000 Error {000}: [00000003] Invalid mime type "binary": does not contain '/'
I tried some options in RSocketOptions but alyaws the same error

Here is my spring server config :

spring:
  rsocket:
    server:
      port: 7000
      transport: tcp

Here is my dotnet program

var client = new RSocketClient(new SocketTransport("tcp://localhost:7000"), new RSocketOptions(){ InitialRequestSize = 3 });
			//var client = new RSocketClient(new WebSocketTransport("ws://localhost:9092/"), new RSocketOptions() { InitialRequestSize = 3 });
			//var client = new RSocketClient(loopback);
			await client.ConnectAsync();

The server is working, I did manage to handle RSocket data with another spring boot client.

Thanks for your help !

Handling FireAndForget request

Maybe I miss something, but how to handle FireAndForget request?
For Request/Response, Request/Channel and Request/Stream we have Funcs Responder, Channeler and Streamer or methods Stream, Respond and Channel, but for FireAndForget we have only trigger method RequestFireAndForget.

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.