GithubHelp home page GithubHelp logo

32600 - Invalid request about jayson HOT 5 CLOSED

tedeh avatar tedeh commented on August 20, 2024
32600 - Invalid request

from jayson.

Comments (5)

raskyer avatar raskyer commented on August 20, 2024

I found out what should I specify in my request like =

{"jsonrpc":"2.0", "method":"add", "params":[10,10]}

But now I got an other problem. (I try using telnet). When I send this with telnet I can't have an answer from the server (basically 10 + 10 result in this example). But callback seem to be a valid function when I console.log it...

from jayson.

raskyer avatar raskyer commented on August 20, 2024

Okay really sorry @tedeh I'm starting to understand.

On the server/index.js we got those lines =>

 var respond = function(error, result) {
      if(utils.Request.isNotification(request)) return callback();
      var response = utils.response(error, result, request.id, self.options.version);
      if(response.error) callback(response);
      else callback(null, response);
    };

It seems that when I call the server with the former parameter I mention, the first if is activate =>

 if(utils.Request.isNotification(request)) return callback();

Because callback() has no argument it's an undefined response sent. If I comment this line. Everything seems fine and I got the excepted answer :

{"jsonrpc":"2.0","id":null,"result":20}

from jayson.

raskyer avatar raskyer commented on August 20, 2024

Ok I understand it by looking at utils.isNotification, I need an "id" to get the answer.
Thanks !

from jayson.

tedeh avatar tedeh commented on August 20, 2024

He he, yes, you need an ID or your request is considered a notification, which means that it does not expect a response.

from jayson.

Juan-Bustamante avatar Juan-Bustamante commented on August 20, 2024

Thanks for all these questions and answers. Saved me a lot of time!

from jayson.

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.