Code Monkey home page Code Monkey logo

Comments (1)

AArnott avatar AArnott commented on June 15, 2024

This response looks like this:

I'm confused by your terminology. The JSON object you share is not a response. It is a notification. Responses do not include method names.

I neither can use NotifyAsync method since this method is not a valid method to call in my server methods.

I don't understand this either, because in fact RPC server methods can call NotifyAsync just fine. But as you don't implement the party you are calling a server, and that remote party is the one I believe is sending the notification, I don't know why the party receiving the notification would ever have need to call NotifyAsync.

jsonRpc.AddLocalRpcMethod ought to work, provided the signature of the delegate you provide matches the shape of the params property per the JSON-RPC spec. If it doesn't match, it'll just drop the notification without invoking your delegate. Turning on logging via JsonRpc.TraceSource would allow you to see if such an error is happening.

Another option is to declare a method on a class, and pass an instance of that class is a local target object. That will let the remote party invoke public methods on your locally defined class. Since the method name on this notification isn't a valid C# method name, you can apply the [JsonRpcMethod("Event.eventOccurred")] attribute to the method so that it will be invoked as expected. But again, the same method signature requirement applies, and the logs can help you diagnose this.

from vs-streamjsonrpc.

Related Issues (20)

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.