voryx / ThruwayBundle

Bundle for building Real-time Apps in Symfony
98 stars 47 forks source link

PHP client not connecting to server, not sure how to debug #39

Closed mikeysteele closed 8 years ago

mikeysteele commented 8 years ago

Hi,

I have a problem where publishing from the PHP client doesn't work. There's no obvious errors, the client just doesn't appear to connect to the router. Clients connected using Autobahn.js work fine

Here is my config

voryx_thruway:
    realm: 'realm1'
    url: 'ws://127.0.0.1:8881' #The url that the clients will use to connect to the router
    router:
        ip: '127.0.0.1'  # the ip that the router should start on
        port: '8880'  # public facing port.  If authentication is enabled, this port will be protected
        trusted_port: '8881' # Bypasses all authentication.  Use this for trusted clients.
        authentication: true

And here is the line in my controller which is supposed to send the message:

$this->get('thruway.client')->publish('test.event', ['hello there']);

I'm guessing the connection fails for some reason between the PHP client and the server, but I can't find any errors anywhere. Is there something I've missed?

davidwdan commented 8 years ago

@mikeysteele That doesn't give me a lot to go on. Can you create a sample project with the minimum amount of code and steps to reproduce the problem? Make sure you include the composer.lock file.

mikeysteele commented 8 years ago

I've actually found the problem:

The ClientManager uses the trusted_url config option, not url. Changing my config to have trusted_url fixed the problem. Sorry for wasting your time.