Closed hnq90 closed 9 years ago
hi, you must have the same domains or ip adressess, example
your site works on frontend.dev - 127.0.0.1 you must run nodejs server on frontend.dev:3001
and connect to it using frontend.dev:3001
you are have an insecure connection, browser can not send cookie to another domain
seems like problem here
do not forget clear assets
@oncesk Thanks for your response.
How can I know my nodejs server is running on frontend.dev:3001?
When I go to frontend.dev:3001, I got "Cannot GET /" message.
can you show me you nodejs logs? nodejs server ran with you component configuration in console config
@oncesk Yes, of course. Please check it.
tail -f /var/log/node-socket.log
info: socket.io started
Listening frontend.dev:3001
Set origin: *:*
debug: client authorized
info: handshake authorized 1clP_1qv2McfKY8CmEuT
debug: setting request GET /socket.io/1/websocket/1clP_1qv2McfKY8CmEuT
debug: set heartbeat interval for client 1clP_1qv2McfKY8CmEuT
debug: client authorized for
debug: websocket writing 1::
debug: client unauthorized for /client
warn: handshake error NO COOKIE TRANSMITTED for /client
debug: websocket writing 7::/client:undefined
debug: emitting heartbeat for client 1clP_1qv2McfKY8CmEuT
debug: websocket writing 2::
debug: set heartbeat timeout for client 1clP_1qv2McfKY8CmEuT
debug: got heartbeat packet
debug: cleared heartbeat timeout for client 1clP_1qv2McfKY8CmEuT
debug: set heartbeat interval for client 1clP_1qv2McfKY8CmEuT
debug: emitting heartbeat for client 1clP_1qv2McfKY8CmEuT
debug: websocket writing 2::
debug: set heartbeat timeout for client 1clP_1qv2McfKY8CmEuT
debug: got heartbeat packet
debug: cleared heartbeat timeout for client 1clP_1qv2McfKY8CmEuT
debug: set heartbeat interval for client 1clP_1qv2McfKY8CmEuT
debug: emitting heartbeat for client 1clP_1qv2McfKY8CmEuT
debug: websocket writing 2::
debug: set heartbeat timeout for client 1clP_1qv2McfKY8CmEuT
debug: got heartbeat packet
debug: cleared heartbeat timeout for client 1clP_1qv2McfKY8CmEuT
debug: set heartbeat interval for client 1clP_1qv2McfKY8CmEuT
info: transport end (undefined)
debug: set close timeout for client 1clP_1qv2McfKY8CmEuT
debug: cleared close timeout for client 1clP_1qv2McfKY8CmEuT
debug: cleared heartbeat interval for client 1clP_1qv2McfKY8CmEuT
debug: discarding transport
tail: /var/log/node-socket.log: file truncated
info: socket.io started
{ host: 'frontend.dev',
port: 3001,
origin: ' *:*',
allowedServers: { '0': '127.0.0.1', '1': 'localhost', '3': 'frontend.dev' },
dbOptions: { driver: 'dummy', config: [] },
checkClientOrigin: 1,
sessionVarName: 'PHPSESSID',
socketLogFile: '/var/log/node-socket.log' }
Listening frontend.dev:3001
Set origin: *:*
ok, what do you see in your browser console?
oncesk is my skype you can write me
@oncesk Oh, thank you. There're some people which have Skype account similiar to oncesk
. Are you Aliaksei Panasik
?
My Skype account is naruto_thf90
.
Thanks.
Yes
Отправлено с моего Xiaomi
Сообщение от "Huy Nguyen Quang notifications@github.com":
@oncesk Oh, thank you. There're some people which have Skype account similiar with oncesk. Are you Aliaksei Panasik?
My Skype account is naruto_thf90.
Thanks.
— Reply to this email directly or view it on GitHub.
Hi! Did you solve this issue? I have such problem too.
Hi, yes @hnq90 solved this problem, show your configuration
I use yii1 version. 'nodeSocket' => array( 'class' => '\NodeSocket', 'host' => 'hoo.com.ua', // default is 127.0.0.1, can be ip or domain name, without http 'port' => 8081, // default is 3001, should be integer 'allowedServerAddresses' => array('46.101.160.165') ),
On which domain working your website? Show your nodejs logs
Сообщение от "tolik505 notifications@github.com":
I use yii1 version. 'nodeSocket' => array( 'class' => '\NodeSocket', 'host' => 'hoo.com.ua', // default is 127.0.0.1, can be ip or domain name, without http 'port' => 8081, // default is 3001, should be integer 'allowedServerAddresses' => array('46.101.160.165') ),
— Reply to this email directly or view it on GitHub.
Sure info: socket.io started Listening hoo.com.ua:8081 Set origin: hoo.com.ua:* debug: client authorized info: handshake authorized zQSkeXEDmb1i4p-t5eF debug: setting request GET /socket.io/1/websocket/zQSkeXEDmb1i4p-t5eF debug: set heartbeat interval for client zQSkeXEDmb1i4p-t5eF debug: client authorized for debug: websocket writing 1:: debug: client unauthorized for /client warn: handshake error NO COOKIE TRANSMITTED for /client debug: websocket writing 7::/client:undefined debug: client authorized info: handshake authorized cYF7tdWcRbVLQMzd5eGA debug: setting request GET /socket.io/1/websocket/cYF7tdWcRbVLQMzd5eGA debug: set heartbeat interval for client cYF7tdWcRbVLQMzd5eGA debug: client authorized for debug: websocket writing 1:: debug: client unauthorized for /client warn: handshake error NO COOKIE TRANSMITTED for /client debug: websocket writing 7::/client:undefined info: transport end (undefined) debug: set close timeout for client zQSkeXEDmb1i4p-t5eF debug: cleared close timeout for client zQSkeXEDmb1i4p-t5eF debug: cleared heartbeat interval for client zQSkeXEDmb1i4p-t5eF debug: discarding transport debug: served static content /socket.io.js debug: client authorized info: handshake authorized GFlN2eE0eXWlMcHh5eGB debug: setting request GET /socket.io/1/websocket/GFlN2eE0eXWlMcHh5eGB debug: set heartbeat interval for client GFlN2eE0eXWlMcHh5eGB debug: client authorized for debug: websocket writing 1:: debug: client unauthorized for /client warn: handshake error NO COOKIE TRANSMITTED for /client debug: websocket writing 7::/client:undefined
Your wensite domain should be hoo.com.ua
Отправлено с моего Xiaomi
Сообщение от "tolik505 notifications@github.com":
Sure info: socket.io started Listening hoo.com.ua:8081 Set origin: hoo.com.ua:* debug: client authorized info: handshake authorized zQSkeXEDmb1i4p-t5eF debug: setting request GET /socket.io/1/websocket/zQSkeXEDmb1i4p-t5eF debug: set heartbeat interval for client zQSkeXEDmb1i4p-t5eF debug: client authorized for debug: websocket writing 1:: debug: client unauthorized for /client warn: handshake error NO COOKIE TRANSMITTED for /client debug: websocket writing 7::/client:undefined debug: client authorized info: handshake authorized cYF7tdWcRbVLQMzd5eGA debug: setting request GET /socket.io/1/websocket/cYF7tdWcRbVLQMzd5eGA debug: set heartbeat interval for client cYF7tdWcRbVLQMzd5eGA debug: client authorized for debug: websocket writing 1:: debug: client unauthorized for /client warn: handshake error NO COOKIE TRANSMITTED for /client debug: websocket writing 7::/client:undefined info: transport end (undefined) debug: set close timeout for client zQSkeXEDmb1i4p-t5eF debug: cleared close timeout for client zQSkeXEDmb1i4p-t5eF debug: cleared heartbeat interval for client zQSkeXEDmb1i4p-t5eF debug: discarding transport debug: served static content /socket.io.js debug: client authorized info: handshake authorized GFlN2eE0eXWlMcHh5eGB debug: setting request GET /socket.io/1/websocket/GFlN2eE0eXWlMcHh5eGB debug: set heartbeat interval for client GFlN2eE0eXWlMcHh5eGB debug: client authorized for debug: websocket writing 1:: debug: client unauthorized for /client warn: handshake error NO COOKIE TRANSMITTED for /client debug: websocket writing 7::/client:undefined
— Reply to this email directly or view it on GitHub.
It is. But NO COOKIE TRANSMITTED
You can check it in chrome dev tool when send first get request(handshake), check which headers sent, you can print headers in server.js
If you have the same domains cookies should be sent
Отправлено с моего Xiaomi
Сообщение от "tolik505 notifications@github.com":
It is. But NO COOKIE TRANSMITTED
— Reply to this email directly or view it on GitHub.
You are right, the host is different { headers: { host: 'hoo.dev.vintagedev.com.ua:8081', connection: 'keep-alive', 'cache-control': 'max-age=0', origin: 'http://hoo.com.ua', 'user-agent': 'Mozilla/5.0 (X11; Linux x8664) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36', accept: '/_', referer: 'http://hoo.com.ua/', 'accept-encoding': 'gzip, deflate, sdch', 'accept-language': 'ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4,uk;q=0.2' }, time: 'Tue Nov 24 2015 15:01:19 GMT-0500 (EST)', query: { t: '1448395278330' }, url: '/socket.io/1/?t=1448395278330', xdomain: true, secure: undefined } How have I set the configuration to fix this problem?
You can try to proxying requests from
hoo.dev.vintagedev.com.ua server to hoo.com.ua, use nginx or iptables......
you can try to set document.domain to the same domain level, but i think this will not work because you domain zone is com.ua and domain name is different
....
Сообщение от "tolik505 notifications@github.com":
You are right, the host is different { headers: { host: 'hoo.dev.vintagedev.com.ua:8081', connection: 'keep-alive', 'cache-control': 'max-age=0', origin: 'http://hoo.com.ua', 'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36', accept: '/', referer: 'http://hoo.com.ua/', 'accept-encoding': 'gzip, deflate, sdch', 'accept-language': 'ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4,uk;q=0.2' }, time: 'Tue Nov 24 2015 15:01:19 GMT-0500 (EST)', query: { t: '1448395278330' }, url: '/socket.io/1/?t=1448395278330', xdomain: true, secure: undefined } How have I set the configuration to fix this problem?
— Reply to this email directly or view it on GitHub.
you can set the same domains
I'm not strong in nginx configuration. You say, I must change hostname 'hoo.dev.vintagedev.com.ua' to 'hoo.com.ua'. Is it right?
@tolik505 yes, you should do it.
yes, and all will works, or you can use the same top level domain like
hoo.com.ua
then if you will create subdomains and you need nodesocket you need to set in javascript document.domain = 'hoo.com.ua';
example, for domain dev.hoo.com.ua and cookie will send
2015-11-25 11:50 GMT+03:00 tolik505 notifications@github.com:
I'm not strong in nginx configuration. You say, I must change hostname ' hoo.dev.vintagedev.com.ua' to 'hoo.com.ua'. Is it right?
— Reply to this email directly or view it on GitHub https://github.com/oncesk/yii-node-socket/issues/66#issuecomment-159537209 .
I've changed hostname, but log show the same host: 'hoo.dev.vintagedev.com.ua:8081'. http://joxi.ru/gmv70o9ixyZD02, http://joxi.ru/5mdQO83uv46gQ2. Perhaps, I've made something wrong.
so, as i can see you have one server and several domains, in this case you can start your nodejs server on hoo.dev.vintagedev.com
change yii configuration, restart server, and check
With that config
'nodeSocket' => array(
'class' => '\NodeSocket',
'host' => 'hoo.dev.vintagedev.com',
'port' => 8081,
'allowedServerAddresses' => array('46.101.160.165')
),
info: socket.io started Listening 46.101.160.165:8081 Set origin: hoo.dev.vintagedev.com:* warn: illegal origin: http://hoo.com.ua
With that config
'nodeSocket' => array(
'class' => '\NodeSocket',
'host' => '46.101.160.165',
'port' => 8081,
'allowedServerAddresses' => array('46.101.160.165')
),
info: socket.io started
Listening 46.101.160.165:8081
Set origin: 46.101.160.165:*
debug: served static content /socket.io.js
warn: illegal origin: http://hoo.com.ua
so, can you describe you app structure
you can set origin in your yii configuration
'origin' => '*:*'
and seems like you forget clean assets after changed yii configuration
Yes, you're right! I forgot to clean assets. But now, when I send message, there is such error Exception
Failed to connect to hoo.com.ua port 8081: Connection refused (/var/www/hoo/vendor/oncesk/yii-node-socket/lib/vendor/elephant.io/lib/ElephantIO/Client.php:372)
Seems like you forgit change yii configuration for web app, main.php config file
Отправлено с моего Xiaomi
Сообщение от "tolik505 notifications@github.com":
Yes, you're right! I forgot to clean assets. But now, when I send message, there is such error Exception
Failed to connect to hoo.com.ua port 8081: Connection refused (/var/www/hoo/vendor/oncesk/yii-node-socket/lib/vendor/elephant.io/lib/ElephantIO/Client.php:372)
0 /var/www/hoo/vendor/oncesk/yii-node-socket/lib/vendor/elephant.io/lib/ElephantIO/Client.php(66): ElephantIO\Client->handshake()
1 /var/www/hoo/vendor/oncesk/yii-node-socket/lib/php/frames/AFrame.php(167): ElephantIO\Client->init()
2 /var/www/hoo/vendor/oncesk/yii-node-socket/lib/php/frames/AFrame.php(76): YiiNodeSocket\Frames\AFrame->emit()
3 /var/www/hoo/frontend/modules/user/controllers/PmController.php(134): YiiNodeSocket\Frames\AFrame->send()
4 [internal function]: user\controllers\PmController->actionView('32', '31')
— Reply to this email directly or view it on GitHub.
Configurations in console/config/main.php and in frontend/config/main.php are identical. 'nodeSocket' => array( 'class' => '\NodeSocket', 'host' => 'hoo.com.ua', 'port' => 8081, 'allowedServerAddresses' => array('46.101.160.165'), ),
did you remove 127.0.0.1 hoo.com.ua from /etc/hosts?
your website on domain hoo.com.ua and nodejs too, is it correct?
did you remove 127.0.0.1 hoo.com.ua from /etc/hosts? no, I didn't. Have I remove this row? your website on domain hoo.com.ua and nodejs to, is it correct? Yes, it is. { headers: { host: 'hoo.com.ua:8081', connection: 'keep-alive', 'user-agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36', origin: 'http://hoo.com.ua',
Events which are emitted in js, work perfectly, but events are emitted in action lead to the error.
remove, and try to check
Yes, it works! Thanks a lot! You really helped me! You're a great man!
excellent, do not at all)
Hello... I have the same issue...warn: handshake error NO COOKIE TRANSMITTED for /client How can I solve it?
Hello,
This message can be mostly in two cases:
24 янв. 2017 г. 18:40 пользователь "Doru Popescu" notifications@github.com написал:
Hello... I have the same issue...warn: handshake error NO COOKIE TRANSMITTED for /client How can I solve it?
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/oncesk/yii-node-socket/issues/66#issuecomment-274839934, or mute the thread https://github.com/notifications/unsubscribe-auth/AB84jO3iK1uNL4Xill5qnNt8P_H-d0yNks5rVhtdgaJpZM4GawoH .
Hello @oncesk I'm using your library with yii2 advanced template. Each time I connect to socket server, I got this
handshake error NO COOKIE TRANSMITTED for /client
I have to use these configurations to got socker server running (
yii node-socket/start
).I'm using frontend.dev for my virtualhost domain.
In
console/config/main.php
In
frontend/config/main.php
In
common/config/main.php
:I tried to log the handshakeData but there's no cookie attribute and host become
'0.0.0.0:3001'
.Thank you in advance.