Code Monkey home page Code Monkey logo

guzzle-jsonrpc's Issues

Upgrade to Guzzle 6?

I use this package on Drupal 8, but composer can no longer resolve because Drupal needs Guzzle 6.

EventDispatcher problem

Hi, first of all, thank you for your implementation of JSON-RPC for Guzzle.

I had some problems with it, specially with EventDispatcher. I think when your create your Request type, you must set to it EventDispatcher from client:

// path/to/vendor/Graze/Guzzle/JsonRpc/Message/Request.php

public function __construct(RequestInterface $request, $method, $id = null)
    {
        parent::__construct($request->getMethod(), $request->getUrl(), $request->getHeaders());

        $this->setClient($request->getClient());
        // this fixes the problem
        $this->setEventDispatcher($request->getClient()->getEventDispatcher());
        $this->rpcFields = new Collection(array(
            'jsonrpc' => JsonRpcClientInterface::VERSION,
            'method'  => (string) $method
        ));

        if (null !== $id) {
            $this->setRpcField('id', $id);
        }
    }

I had problems when used MisdGuzzleBundle. This bundle allows to log requests, but it does not work with your client, because it has not correct EventDispatcher.

Missing ability to send array of requests

In JSON-RPC specification you can send an array or request and receive an array of responses.
In some scenarios, it may slightly increase performance in the library will send N asynced HTTP requests with M JSON-RPC requests in each.

Undeclared InvalidArgumentException

src/Message/MessageFactory.php contains 2 methods: fromResponse() and createRequest() that can throws undeclared InvalidArgumentException. Fix it, please.

Error code accepted range

The current implementation accepts only the following error codes:

array_merge(array(-32700), range(-32600, -32603), range(-32000, -32099))

This is the source code from "JsonRpc/Message/ErrorResponse.php".

However, the JSON-RPC specification allows any integer. See (http://www.jsonrpc.org/specification) which says: "5.1 Error object -> code -> A Number that indicates the error type that occurred. This MUST be an integer."

That's all. After that a few reserved codes for pre-defined errors are listed. It seems that you've misinterpreted those reserved codes as the only one which are accepted. While actually, those reserved codes should be used as specified and "the remainder of the space is available for application defined errors."

Please allow us to use arbitrary integer error codes in our applications.

Debug PHP5.6 functional test server issues

The server fails to run in PHP 5.6.0 on Travis-CI but work fine on 5.6.0-1 in development.

# Travis CI
$ php --version
PHP 5.6.0 (cli) (built: Sep  3 2014 23:16:07) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies
    with Xdebug v2.2.5, Copyright (c) 2002-2014, by Derick Rethans

# Development
php --version
PHP 5.6.0-1+deb.sury.org~precise+1 (cli) (built: Sep 10 2014 14:24:05)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies
    with Xdebug v2.2.5, Copyright (c) 2002-2014, by Derick Rethans

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.