Giter Site home page Giter Site logo

wamppost's People

Contributors

davidwdan avatar mbonneau avatar nepda avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

wamppost's Issues

installation step

I found that, instead of :

php composer.phar require "voryx/wamppost":"dev-master"

I must use this to complete my installation steps :

composer require "voryx/wamppost"

Internal Server Error

I got Error 500: Internal Server Error when I call
curl -H "Content-Type: application/json"
-d '{"procedure": "com.server.order.status"}'
http://127.0.0.1:8181/

When I inspect the code little bit I printed the error

#message: "Too few arguments to function WampPost\WampPost::handleRequest(), 1 passed in /Users/zack/Sites/app/vendor/react/http/src/Io/MiddlewareRunner.php on line 49 and exactly 2 expected"

WampPost with Guzzle\Http

Hi
As I wanted to disconnect a client, but from not from the browser, I thought of a solution with a PHP Client which make an RPC call from Apache. I have not managed to run the example of issue 42 (voryx/Thruway#42).
I followed the advice of @mbonneau and downloaded WampPost.
My WampPost Client is like this :

...
$router = new Router();

$wp = new WampPost\WampPost($realm, $router->getLoop(), '127.0.0.1', 8181);

$router->addTransportProvider(new Thruway\Transport\InternalClientTransportProvider($wp));

$transportProvider = new RatchetTransportProvider("127.0.0.1", 9090);
$router->addTransportProvider($transportProvider);

$router->registerModules([
    new \Thruway\Authentication\AuthenticationManager(),
    new ChatInternalClient($realm)
]);

$router->addInternalClient(new JwtAuthenticationProvider([$realm], $jwtkey));

$router->start();

The ChatInternalClient (extends RouterModuleClient) contains the RPC register in onSessionStart. Like this:

$this->getCallee()->register($this->session, 'com.hostname.ban', [$this, 'banClient']);

And the banClient function:

$args = $args[0];
$this->router
    ->getSessionBySessionId($args['session'])
    ->shutdown();

I make the HTTP call with Guzzle/Http like this

$client = new Client('http://127.0.0.1:8181');
$request = $client->post('/call', [
    'headers' => ['Content-Type' => 'application/json'],
    'body' => '{"procedure": "com.hostname.ban"}'
]);
$response = $request->send();

I have no errors, nothing in my Router terminal. the ChatInternalClient is not called.
The response of the Guzzle Client call is a 404 not found.
I try to put the port in the array of the post method ('port' => 8181). Result is the same.
And I do not know how to auth this WampPost client with JwtAuthenticationProvider...
I am kinda lost...
Any help will be very very appreciated.
Thanks

P.S. : There is an error in WampPost.php line 94 :

$options = isset($json->options) && is_object($json->opitons) ? $json->options : null;

$options = isset($json->options) && is_object($json->options) ? $json->options : null;

Broken dependencies - \React\Socket\Server::__construct needs two arguments

If you install the voryx/wamppost package in version 0.1.5 (composer.json like below)

You will get an error because the usage of \React\Socket\Server::__construct has changed. But your code does'nt:

src/WampPost/WampPost.php:32:

        $this->socket = new Server($loop);

But the signature of the class looks like this:

    public function __construct($uri, LoopInterface $loop, array $context = array())

composer.json:

{
    "name": "nepda/wamp-post-example",
    "type": "project",
    "require": {
        "voryx/wamppost": "^0.1.5"
    }
}

Help configuring port in online server

Hi!

This is not an error of the component, which works great and I'm very thankful for it as it's very nice, really.

I'd need some guidance with my process of going online with it. The issue is:

I'm using WampPost and particularly I'm running the serverWithClient.php file in order to do both server functions and send HTTP requests in other points of the app.
At javascript level I'm using autobahn.js. When working on localhost everything goes fine. Now I'm trying to go online and I cannot make it work.

I don't know if it is something with the javascript, the php or the port configs.

The ws file is located at //[root]/ws/bin/serverWithClient.php. In there, I use port 8181 for WampPost and 9090 for the router.

My javascript runs in //[root]/www/assets/js/notifications.js and it does the following in order to connect:

var connection = new autobahn.Connection({url: 'ws://[serverDomain]:9090/', realm: '[realmName]'})

Where serverDomain is the site's domain and realmName is just that: the realm name (in the example is realm1).

Now, in my centos server I tried the to open both 9090 and 8181 ports. I did the following (at console):

iptables -A INPUT -p tcp --dport 9090 -j ACCEPT
iptables -A INPUT -p tcp --dport 8181 -j ACCEPT

Then I've saved the iptable configuration and restarted the iptables in order to apply the changes. Finally, in the console again, I start the ws server as I do in localhost, by doing:

php /[root]/ws/bin/serverWithClient.php

The server starts fine, but then I go to the address and the browser says that the connection is refused.

I think that what's wrong is the server config, but I really don't know. I'm lost here, so if you could guide me a little would be nice.

Thanks in advance and, again, very nice component you made!

Failed on latest tag

I try to install the latest 0.2.0
but it gave me errors :

PHP Fatal error: Uncaught InvalidArgumentException: Invalid URI "tcp://127.0.0.1" given in /home/andiadh/wamppost/vendor/react/socket/src/TcpServer.php:149

Stack trace:
#0 /home/andiadh/wamppost/vendor/react/socket/src/Server.php(35): React\Socket\TcpServer->__construct('tcp://127.0.0.1', Object(React\EventLoop\StreamSelectLoop), Array)

#1 /home/andiadh/wamppost/vendor/voryx/wamppost/src/WampPost/WampPost.php(26): React\Socket\Server->__construct('127.0.0.1', Object(React\EventLoop\StreamSelectLoop))

#2 /home/andiadh/wamppost/wamppost.php(5): WampPost\WampPost->__construct('realm1', Object(React\EventLoop\StreamSelectLoop), '127.0.0.1', 8181)

#3 {main}
thrown in /home/andiadh/wamppost/vendor/react/socket/src/TcpServer.php on line 149

I then revert downloading 0.1.5 and everything goes well
Please advice

Error details

I'm calling a procedure this way:

$data_string = json_encode([
    'procedure' => 'installer.setup_profile',
    'args' => ['test_0001']
]);

$ch = curl_init("127.0.0.1:8181/call");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Content-Type: application/json',
    'Content-Length: ' . strlen($data_string))
);

$result = curl_exec($ch);
$decoded = json_decode($result, true);

The wamppost peer receives a detailed error message:

2016-01-28T17:39:20.7687680 debug      [Thruway\Transport\PawlTransportProvider 6944] Received: [8,48,1108345346,{},"installer.setup_profile.error",[{"command":"mkdir test_0001","folder":"\/var\/www\/http\/project0001\/profiles","code":1,"signal":null}],{"details":"One of the commands has failed. Please check args."}]
2016-01-28T17:39:20.7694130 debug      [WampPost\WampPost 6944] Client onMessage: installer.setup_profile.error

But the $result variable contains only:

{"result":"ERROR"}

I might have done something wrong, but it seems WampPost don't deliver all the error information, and I miss useful debug stuff. Is there any way to make WampPost return the missing error information?

Installation out the box fails - "Your requirements could not be solved"

Hi

Thank you for this great piece of code. It is a game changer for me in terms of hooking up legacy systems via simple rest calls to new realtime systems. Your solution is by far the most elegant and does not come with houndreds of dependancies.

Just one small problem. voryx/thryway 0.3.x-dev does not exist as defined by composer.json

The output I get in installation is

  • Installation request for voryx/wamppost dev-master -> satisfiable by voryx/wamppost[dev-master].
    • voryx/wamppost dev-master requires voryx/thruway 0.3.x-dev -> no matching package found.

Typo probably prevents options from working

I believe there is a typo on line 99 of file /src/WampPost/WampPost.php:

$options = isset($json->options) && is_object($json->opitons) ? $json->options : null;

It should be:

$options = isset($json->options) && is_object($json->options) ? $json->options : null;

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.