crossbario / crossbar

Crossbar.io - WAMP application router
https://crossbar.io/
Other
2.05k stars 274 forks source link

HTTP Bridge blocks only for "caller", publisher works perfectly #861

Closed ARoddis closed 8 years ago

ARoddis commented 8 years ago

Hey!

First of all, thank you for this great tool! :D I realy enjoy working with crossbar.io.

I have one little (big) problem though...i configured a HTTP-Bridge-Caller:

{
    "version": 2,
    "controller": {},
    "workers": [
        {
            "type": "router",
            "realms": [
                {
                    "name": "realm1",
                    "roles": [
                        {
                            "name": "anonymous",
                            "permissions": [
                                {
                                    "uri": "dsa_online.public.*",
                                    "allow": {
                                        "call": true,
                                        "register": false,
                                        "publish": true,
                                        "subscribe": true
                                    }
                                }
                            ]
                        },
                        {
                            "name": "user",
                            "permissions": [
                                {
                                    "uri": "dsa_online.public.*",
                                    "allow": {
                                        "call": true,
                                        "register": true,
                                        "publish": true,
                                        "subscribe": true
                                    }
                                }
                            ]
                        },
                        {
                            "name": "admin",
                            "permissions": [
                                {
                                    "uri": "*",
                                    "allow": {
                                        "call": true,
                                        "register": true,
                                        "publish": true,
                                        "subscribe": true
                                    }
                                }
                            ]
                        },
                        {
                            "name": "phpapp",
                            "permissions": [
                                {
                                    "uri": "*",
                                    "allow": {
                                        "call": true,
                                        "register": true,
                                        "publish": true,
                                        "subscribe": true
                                    }
                                }
                            ]
                        }
                    ]
                }
            ],
            "transports": [
                {
                    "type": "websocket",
                    "endpoint": {
                        "type": "tcp",
                        "port": 9005,
                        "interface": "127.0.0.1"
                    },
                    "auth": {
                        "wampcra": {
                            "type": "static",
                            "users": {
                                "phpapp": {
                                    "secret": "secretsecret",
                                    "role": "phpapp"
                                }
                            }
                        }
                    }
                },
                {
                    "type": "web",
                    "endpoint": {
                        "type": "tcp",
                        "port": 8080
                    },
                    "paths": {
                        "publish": {
                            "type": "publisher",
                            "realm": "realm1",
                            "role": "phpapp"
                        },
                        "call": {
                            "type": "caller",
                            "realm": "realm1",
                            "role": "phpapp"
                        },
                        "ws": {
                            "type": "websocket",
                            "auth": {
                                "wampcra": {
                                    "type": "dynamic",
                                    "authenticator": "dsa_online.security.wamp.authenticate"
                                }
                            }
                        }
                    },
                    "options":{
                        "key": "phpapp",
                        "secret": "secretsecret",
                        "require_ip": ["127.0.0.1"]
                    }
                }
            ]
        },
        {
            "type": "guest",
            "executable": "/usr/bin/env",
            "arguments": [
                "php",
                "/var/www/api/bin/console",
                "wamp:authenticator",
                "--username=phpapp",
                "--secret=secretsecret"
            ]
        }
    ]
}

The publishers works fine and publishes events to my autobahn-js-clients as expected.

even the authentication method works fine in the browser and php. :)

But if i use the same php-client-lib (guzzle) to do a call (of course i change the bodyjson to include "procedure" etc) the request timesout...

Even if I do it on the cli with curl it times out:

" curl -H "Content-Type: application/json" -d '{"procedure": "dsa_online.public.calls.test", "args": [1, 2]}' http://127.0.0.1:8080/call"

On the log i get (even on debugmode) just this one line:

2016-08-21T12:21:06+0000 [Router 21613 crossbar.adapter.rest.caller.CallerResource] REST bridge request recieved. (path='/call', method=POST)

Thats all....nothing more.

Does anyone know why this problem occurs? Im a bit clueless... :/

Thank you alot! :)

meejah commented 8 years ago

Works for me with master on Python 2 and Python 3 (I registered a procedure "foo" and called it via curl like you do above). I also get back JSON with an "error" key if foo throws an exception. If you're still having problems, can you either try asking on the mailing-list or IRC or post crossbar version output and more details?