voryx / Thruway

PHP Client and Router Library for Autobahn and WAMP (Web Application Messaging Protocol) for Real-Time Application Messaging
MIT License
676 stars 118 forks source link

[3,{},"thruway.error.unknown"] after challenge sent to server #295

Closed Robthegod23 closed 6 years ago

Robthegod23 commented 6 years ago

About 2 months ago, I successfully created a realtime messaging system utilizing Thruway, ZMQ, and MySQL for authentication, all on a MAMP server. Upon returning to this project, There seems to be an issue with the connection to my Thruway server, as when I attempt to connect, the connection fails immediately, leaving this trace in the browser network console:

screen shot 2018-04-13 at 3 21 54 pm

Here is the frontend Autobahn logic:

  let connection = new autobahn.Connection({
      url: 'ws://127.0.0.1:7474',
      realm: 'default',
      onchallenge: (session, method, extra) => {
        if(method === 'token') {
         return '7DgM9KxdOlFitfYtUojKUH4qsOcGYs'
        }
      },
      authmethods: ['token']
  })

where I authenticate the connection using a token stored in MySQL.

Here is my Server Log:

2018-04-13T19:09:36.4511630 debug [Thruway\Transport\RatchetTransportProvider 3823] RatchetTransportProvider::onOpen 2018-04-13T19:09:36.4527240 debug [Thruway\Transport\RatchetTransportProvider 3823] onMessage: ([1,"default",{"roles":{"caller":{"features":{"caller_identification":true,"progressive_call_results":true}},"callee":{"features":{"caller_identification":true,"pattern_based_registration":true,"shared_registration":true,"progressive_call_results":true,"registration_revocation":true}},"publisher":{"features":{"publisher_identification":true,"subscriber_blackwhite_listing":true,"publisher_exclusion":true}},"subscriber":{"features":{"publisher_identification":true,"pattern_based_subscription":true,"subscription_revocation":true}}},"authmethods":["token"]}]) 2018-04-13T19:09:36.4528480 info [Thruway\RealmManager 3823] Got prehello... 2018-04-13T19:09:36.4535270 debug [App\Realtime\Auth\TokenAuth 3823] Client onMessage: [Thruway\Message\InvocationMessage] 2018-04-13T19:09:36.4536950 debug [Thruway\Authentication\AuthenticationManager 3823] Client onMessage: [Thruway\Message\ResultMessage] 2018-04-13T19:09:36.4563590 debug [Thruway\Transport\RatchetTransportProvider 3823] onMessage: ([5,"7DgM9KxdOlFitfYtUojKUH4qsOcGYs",{}]) 2018-04-13T19:09:36.4569040 debug [App\Realtime\Auth\TokenAuth 3823] Client onMessage: [Thruway\Message\InvocationMessage] 2018-04-13T19:09:36.4577190 debug [Thruway\Authentication\AuthenticationManager 3823] Client onMessage: thruway.auth.token.onauthenticate.error 2018-04-13T19:09:36.4578600 error [Thruway\Authentication\AuthenticationManager 3823] onauthenticate rejected the promise 2018-04-13T19:09:36.4580290 debug [Thruway\Realm 3823] Leaving realm default 2018-04-13T19:09:36.4582600 info [Thruway\Transport\RatchetTransportProvider 3823] Ratchet has closed

I updated all composer dependencies ... So why is this connection suddenly failing?