yii-node-socket icon indicating copy to clipboard operation
yii-node-socket copied to clipboard

Problem with Client Connection

Open juliusceshar opened this issue 11 years ago • 4 comments

Very interesting solution, but I have a problem to make it run "can not get the connection of socket.io client web server." You can add more examples for this.

juliusceshar avatar Nov 28 '13 05:11 juliusceshar

Hi, of course i add more examples,i think in this weekend.

Can you show me nodejs log, log file locates into protected/runtime/socket-transport.server.log

i think problem into yii configuration (if host set as ip address), with Access-Control-Allow-Origin , example: if you create virtual host with domain test, try set this domain into your yii configuration instead of host

try that

'nodeSocket' => array(
    'class' => 'ext.yii-node-socket.lib.php.NodeSocket',
    'host' => 'test'
),

For more details i need to see server logs

Thank you

oncesk avatar Nov 28 '13 05:11 oncesk

Thanks for replying Well I have this in log:

 info: socket.io started
debug: served static content /socket.io.js
warn: illegal origin: http://localhost
debug: served static content /socket.io.js
warn: illegal origin: http://localhost
debug: served static content /socket.io.js
warn: illegal origin: http://localhost
debug: served static content /socket.io.js 

I have the config/main settings with these parameters:

'components'=>array(
            'nodeSocket' => array(
                'class' => 'application.extensions.yii-node-socket.lib.php.NodeSocket',
                'host' => '127.0.0.1',  // default is 127.0.0.1, can be ip or domain name, without http
                'port' => 3001      // default is 3001, should be integer
            ),
        ...................

I have no problem with the server, also the conexiono between php and the server works. But apparently the web client can not connect. Now I'm just testing it on my local server, ie "localhotst /application/ controller / action" and in my view I have the javascript code for the Connection:


Now in mozilla firebug shows me this:

GET http://127.0.0.1:3001/socket.io/1/?t=1385665187586
1385665187590: Attach event listener for event: invoke
1385665187591: Compiled event name: system:invoke
1385665187591: Attach event listener for event: jquery
1385665187592: Compiled event name: system:jquery
1385665187592: Attach event listener for event: updateBoard
1385665187593: Compiled event name: updateBoard
"NetworkError: 403 Forbidden - http://127.0.0.1:3001/socket.io/1/?t=1385665187586"

firebug shows me that there is error connection with GET request. I'll be very grateful if you can help me in this problem.

juliusceshar avatar Nov 28 '13 19:11 juliusceshar

I just try a different way with a different route

 127.0.0.1/appliccation/controller/action
With a route so it works 

but with a path in this format

 localhost / appliccation / controller / action
not work  pre>
Any idea what could be the problem?

juliusceshar avatar Nov 28 '13 20:11 juliusceshar

Hi, try this config

'nodeSocket' => array(
                'class' => 'application.extensions.yii-node-socket.lib.php.NodeSocket',
                'host' => 'localhost',
                'port' => 3001      // default is 3001, should be integer
),

and in browser you can use http://localhost

oncesk avatar Nov 29 '13 07:11 oncesk