These are chat archives for oncesk/yii-node-socket

5th
Oct 2015
Doru Popescu
@dorw123
Oct 05 2015 14:50
Sorry to disturbe you again, but I`m getting this message on javascript console: "Uncaught ReferenceError: io is not defined". Could you help me please.
Doru Popescu
@dorw123
Oct 05 2015 15:25
looks like the node.js server isn`t running despite of executing ./yii node-socket/start who is telling me that the server started succesfully
Doru Popescu
@dorw123
Oct 05 2015 15:39
after I started manually server.js it throws me another error. GET http://localhost:8080/socket.io/1/?t=1444059421192 net::ERR_CONNECTION_REFUSED. But I just changed my configuration to point to my IP and Port and yet is returning localhost:8080. I also cleard cache and web assets.
oncesk
@oncesk
Oct 05 2015 16:09
hi
did you see server logs?
what you see in the console output when started it manually?
Doru Popescu
@dorw123
Oct 05 2015 16:11
I managed to solve the issue. it was set inside client.js
oncesk
@oncesk
Oct 05 2015 16:11
so
when you run it manually
you need to compile config
when you run with yii console it doing automaticaly
Doru Popescu
@dorw123
Oct 05 2015 16:13
Yeah... but how can I check if the server is really started?
oncesk
@oncesk
Oct 05 2015 16:14
you need to start it from yii command and see log file
it can contain information about a error
Doru Popescu
@dorw123
Oct 05 2015 16:14
where can I find the log file?
oncesk
@oncesk
Oct 05 2015 16:14
protected/runtime/socket-transport.server.log
line 73
you can set your own log file location
by default its located in protected/runtime/socket-transport.server.log
Doru Popescu
@dorw123
Oct 05 2015 16:18
all right
it`s working
10x
oncesk
@oncesk
Oct 05 2015 16:19
so, do you have any problem right now?)
Doru Popescu
@dorw123
Oct 05 2015 16:24
not right now... but I will ask If I have a problem:). I am thinking to make an example documentation after I finish my implementation. Only if you agree with that.
oncesk
@oncesk
Oct 05 2015 16:27
sounds good)) thank you
Doru Popescu
@dorw123
Oct 05 2015 16:41
Im not really sure why my client isnt listening to my event. I used your https://github.com/oncesk/yii-node-socket#client-authorization. But it doesn`t fire on the event.
oncesk
@oncesk
Oct 05 2015 16:44
did you have curl installed?
you need to see logs
can you paste it here?
Doru Popescu
@dorw123
Oct 05 2015 16:45
info: socket.io started
Listening 192.168.1.119:65080
Set origin: :
debug: client authorized
info: handshake authorized 1BxiVOpPxWoF1uUiyyga
debug: setting request GET /socket.io/1/websocket/1BxiVOpPxWoF1uUiyyga
debug: set heartbeat interval for client 1BxiVOpPxWoF1uUiyyga
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 1BxiVOpPxWoF1uUiyyga
debug: cleared close timeout for client 1BxiVOpPxWoF1uUiyyga
debug: cleared heartbeat interval for client 1BxiVOpPxWoF1uUiyyga
debug: discarding transport
debug: served static content /socket.io.js
debug: client authorized
info: handshake authorized 8NEQq1xnG4dRKRMNyygb
debug: setting request GET /socket.io/1/websocket/8NEQq1xnG4dRKRMNyygb
debug: set heartbeat interval for client 8NEQq1xnG4dRKRMNyygb
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 8NEQq1xnG4dRKRMNyygb
debug: websocket writing 2::
debug: set heartbeat timeout for client 8NEQq1xnG4dRKRMNyygb
debug: got heartbeat packet
debug: cleared heartbeat timeout for client 8NEQq1xnG4dRKRMNyygb
debug: set heartbeat interval for client 8NEQq1xnG4dRKRMNyygb
debug: emitting heartbeat for client 8NEQq1xnG4dRKRMNyygb
debug: websocket writing 2::
debug: set heartbeat timeout for client 8NEQq1xnG4dRKRMNyygb
debug: got heartbeat packet
debug: cleared heartbeat timeout for client 8NEQq1xnG4dRKRMNyygb
debug: set heartbeat interval for client 8NEQq1xnG4dRKRMNyygb
debug: emitting heartbeat for client 8NEQq1xnG4dRKRMNyygb
debug: websocket writing 2::
debug: set heartbeat timeout for client 8NEQq1xnG4dRKRMNyygb
debug: got heartbeat packet
debug: cleared heartbeat timeout for client 8NEQq1xnG4dRKRMNyygb
debug: set heartbeat interval for client 8NEQq1xnG4dRKRMNyygb
debug: emitting heartbeat for client 8NEQq1xnG4dRKRMNyygb
debug: websocket writing 2::
debug: set heartbeat timeout for client 8NEQq1xnG4dRKRMNyygb
debug: got heartbeat packet
debug: cleared heartbeat timeout for client 8NEQq1xnG4dRKRMNyygb
debug: set heartbeat interval for client 8NEQq1xnG4dRKRMNyygb
debug: emitting heartbeat for client 8NEQq1xnG4dRKRMNyygb
debug: websocket writing 2::
debug: set heartbeat timeout for client 8NEQq1xnG4dRKRMNyygb
debug: got heartbeat packet
debug: cleared heartbeat timeout for client 8NEQq1xnG4dRKRMNyygb
debug: set heartbeat interval for client 8NEQq1xnG4dRKRMNyygb
debug: emitting heartbeat for client 8NEQq1xnG4dRKRMNyygb
debug: websocket writing 2::
debug: set heartbeat timeout for client 8NEQq1xnG4dRKRMNyygb
debug: got heartbeat packet
debug: cleared heartbeat timeout for client 8NEQq1xnG4dRKRMNyygb
debug: set heartbeat interval for client 8NEQq1xnG4dRKRMNyygb
debug: emitting heartbeat for client 8NEQq1xnG4dRKRMNyygb
debug: websocket writing 2::
debug: set heartbeat timeout for client 8NEQq1xnG4dRKRMNyygb
debug: got heartbeat packet
debug: cleared heartbeat timeout for client 8NEQq1xnG4dRKRMNyygb
debug: set heartbeat interval for client 8NEQq1xnG4dRKRMNyygb
debug: emitting heartbeat for client 8NEQq1xnG4dRKRMNyygb
debug: websocket writing 2::
debug: set heartbeat timeout for client 8NEQq1xnG4dRKRMNyygb
debug: got heartbeat packet
debug: cleared heartbeat timeout for client 8NEQq1xnG4dRKRMNyygb
debug: set heartbeat interval for client 8NEQq1xnG4dRKRMNyygb
debug: emitting heartbeat for client 8NEQq1xnG4dRKRMNyygb
debug: websocket writing 2::
debug: set heartbeat timeout for client 8NEQq1xnG4dRKRMNyygb
debug: got heartbeat packet
debug: cleared heartbeat timeout for client 8NEQq1xnG4dRKRMNyygb
debug: set heartbeat interval for client 8NEQq1xnG4dRKRMNyygb
debug: emitting heartbeat for client 8NEQq1xnG4dRKRMNyygb
debug: websocket writing 2::
debug: set heartbeat timeout for client 8NEQq1xnG4dRKRMNyygb
debug: got heartbeat packet
debug: cleared heartbea
Im thinking the client isnt authorized. Maybe the authorisation isn`t going through afterLogin
oncesk
@oncesk
Oct 05 2015 16:47
i do not see4 server events
warn: handshake error NO COOKIE TRANSMITTED for /client
you need to enable session
oncesk/yii-node-socket#57
and you must check session variable name if it not PHPSESSID you need to provide it via configuration
oncesk
@oncesk
Oct 05 2015 16:53
and from which domain you do requests?
seems like cookie not sent, because you have relative domains (on wepage and nodejs server)
use domain instead of ip address
Doru Popescu
@dorw123
Oct 05 2015 16:56
but if I go to the domain... ex... 192.168.1.119:65080/client...I get Cannot GET /client
oncesk
@oncesk
Oct 05 2015 16:57
so, which domain do you use into your yii application?
you must use the same address like in web app
if you use apache or nginx with virtual host you should use the same host name in yii-node-socket configuration but different port
Doru Popescu
@dorw123
Oct 05 2015 17:03
not working ... because I use 2 domains. 1 for backend and 1 for frontend. And the domains points to web folder
fontent/web
backend/web
oncesk
@oncesk
Oct 05 2015 17:04
so in this case you should set up domain for backend in javascript
document.domain = 'domain.com'; // domain which listening nodejs
do you use subdomains? if yes you can set top level domain
Doru Popescu
@dorw123
Oct 05 2015 17:08
i`m using no-ip domain
projectx.noip.me
this is what log is telling me now info: handshake authorized E6JT-hskXnkWy2-cyyhc
debug: setting request GET /socket.io/1/websocket/E6JT-hskXnkWy2-cyyhc
debug: set heartbeat interval for client E6JT-hskXnkWy2-cyyhc
debug: client authorized for
debug: websocket writing 1::
debug: client unauthorized for /server
warn: handshake error INVALID SERVER: server host ::ffff:192.168.1.119 not allowed for /server
debug: websocket writing 7::/server:undefined
info: transport end (undefined)
debug: set close timeout for client E6JT-hskXnkWy2-cyyhc
debug: cleared close timeout for client E6JT-hskXnkWy2-cyyhc
debug: cleared heartbeat interval for client E6JT-hskXnkWy2-cyyhc
debug: discarding transport
oncesk
@oncesk
Oct 05 2015 17:09
oy, this is good
you should set approved server ip list
Doru Popescu
@dorw123
Oct 05 2015 17:09
where to set that?
oncesk
@oncesk
Oct 05 2015 17:09
sec
Doru Popescu
@dorw123
Oct 05 2015 17:10
in config/main.php
?
yes
'allowedServerAddresses' => [
"localhost",
"127.0.0.1"
]
this property contains server ip addresses which can send events to nodejs server
Doru Popescu
@dorw123
Oct 05 2015 17:11
        'allowedServerAddresses' => [
            "192.168.1.119",
            "didsecure.no-ip.me"
        ],
debug: discarding transport
debug: served static content /socket.io.js
debug: client authorized
info: handshake authorized n0giwkntTg0mFhXzyyhd
debug: setting request GET /socket.io/1/websocket/n0giwkntTg0mFhXzyyhd
debug: set heartbeat interval for client n0giwkntTg0mFhXzyyhd
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
and yet no cookie transmitted
oncesk
@oncesk
Oct 05 2015 17:13
gm
Doru Popescu
@dorw123
Oct 05 2015 17:13
and set also
    'user' => [
        'identityClass' => 'common\models\User',
        'enableAutoLogin' => true,

    ],
Is there another method to enable cookie based login besides that?
oncesk
@oncesk
Oct 05 2015 17:14
i am thinking
so, you web app domain is didsecure.no-ip.me, is it right?
Doru Popescu
@dorw123
Oct 05 2015 17:15
yes
for frontend
oncesk
@oncesk
Oct 05 2015 17:15
you nodejs server run on which domain or ip?
Doru Popescu
@dorw123
Oct 05 2015 17:15
is set to /frontend/web
same ip as the apache server
oncesk
@oncesk
Oct 05 2015 17:15
now i am not fully understand you configuration
Doru Popescu
@dorw123
Oct 05 2015 17:16
so... I`m running
an apache server
on a lan ip
192.168.1.119
the node server
is running on 192.168.1.119:65080
i`m using vhosts
oncesk
@oncesk
Oct 05 2015 17:17
ok
Doru Popescu
@dorw123
Oct 05 2015 17:17
to bind my domain to this ip
oncesk
@oncesk
Oct 05 2015 17:17
didsecure.no-ip.me this domain?
Doru Popescu
@dorw123
Oct 05 2015 17:17
didsecure.noip.me
lol... I was using wrong domain... it is noip not no-ip
but now
I`m getting
debug: client unauthorized for /server
warn: handshake error INVALID SERVER: server host ::ffff:192.168.1.119 not allowed for /server
debug: websocket writing 7::/server:undefined
info: transport end (undefined)
debug: set close timeout for client 8EVHl-dsOvOuaU00yyhf
debug: cleared close timeout for client 8EVHl-dsOvOuaU00yyhf
debug: cleared heartbeat interval for client 8EVHl-dsOvOuaU00yyhf
debug: discarding transport
not allowed again
why is it using the IP again and not the domain
lol... i tried to restart
the server and now i`m getting some error
oncesk
@oncesk
Oct 05 2015 17:20
=)
Doru Popescu
@dorw123
Oct 05 2015 17:20
Exception 'yii\base\InvalidConfigException' with message 'The configuration for the "user" component must contain a "class" element.'
oncesk
@oncesk
Oct 05 2015 17:21
maybe problem in identityClass?
i do not use yii2))
Doru Popescu
@dorw123
Oct 05 2015 17:23
I don`t understand why warn: handshake error INVALID SERVER: server host ::ffff:192.168.1.119 not allowed for /server
debug: websocket writing 7::/server:undefined
info: transport end (undefined)
debug: set close timeout for client R_-MCMXBOf0bdFQMBoyB
debug: cleared close timeout for client R_-MCMXBOf0bdFQMBoyB
debug: cleared heartbeat interval for client R_-MCMXBOf0bdFQMBoyB
debug: discarding transport
invalid server
oncesk
@oncesk
Oct 05 2015 17:28
try to add ::ffff:192.168.1.119 into yii config for allowed servers
seems like ipv6 is enabled
Doru Popescu
@dorw123
Oct 05 2015 17:30
yeah...should I try to disable ipv6?
oncesk
@oncesk
Oct 05 2015 17:30
you can try to add ::ffff:192.168.1.119 in allowed servers list
it should works
Doru Popescu
@dorw123
Oct 05 2015 17:32
debug: client unauthorized for /client
warn: handshake error NO COOKIE TRANSMITTED for /client
debug: websocket writing 7::/client:undefined
but no more server error
oncesk
@oncesk
Oct 05 2015 17:33
is it full log cat?
Doru Popescu
@dorw123
Oct 05 2015 17:33
no
debug: set close timeout for client bMtPHCbSg0-2gMPpDvGJ
debug: cleared close timeout for client bMtPHCbSg0-2gMPpDvGJ
debug: cleared heartbeat interval for client bMtPHCbSg0-2gMPpDvGJ
debug: discarding transport
debug: served static content /socket.io.js
debug: client authorized
info: handshake authorized LkHyw2Xr-tRWA3HCDvGK
debug: setting request GET /socket.io/1/websocket/LkHyw2Xr-tRWA3HCDvGK
debug: set heartbeat interval for client LkHyw2Xr-tRWA3HCDvGK
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 ze5kBX6M7xi6vijFDvGL
debug: setting request GET /socket.io/1/websocket/ze5kBX6M7xi6vijFDvGL
debug: set heartbeat interval for client ze5kBX6M7xi6vijFDvGL
debug: client authorized for
debug: websocket writing 1::
debug: client authorized for /server
debug: websocket writing 1::/server
info: transport end (undefined)
debug: set close timeout for client ze5kBX6M7xi6vijFDvGL
debug: cleared close timeout for client ze5kBX6M7xi6vijFDvGL
debug: cleared heartbeat interval for client ze5kBX6M7xi6vijFDvGL
debug: discarding transport
debug: client authorized
info: handshake authorized ELKyVEPkmYgAjoMfDvGM
debug: setting request GET /socket.io/1/websocket/ELKyVEPkmYgAjoMfDvGM
debug: set heartbeat interval for client ELKyVEPkmYgAjoMfDvGM
debug: client authorized for
debug: websocket writing 1::
debug: client authorized for /server
debug: websocket writing 1::/server
info: transport end (undefined)
debug: set close timeout for client ELKyVEPkmYgAjoMfDvGM
debug: cleared close timeout for client ELKyVEPkmYgAjoMfDvGM
debug: cleared heartbeat interval for client ELKyVEPkmYgAjoMfDvGM
debug: discarding transport
info: transport end (undefined)
debug: set close timeout for client LkHyw2Xr-tRWA3HCDvGK
debug: cleared close timeout for client LkHyw2Xr-tRWA3HCDvGK
debug: cleared heartbeat interval for client LkHyw2Xr-tRWA3HCDvGK
debug: discarding transport
debug: served static content /socket.io.js
debug: client authorized
info: handshake authorized Kk-YHECeQhkpuBBlDvGN
debug: setting request GET /socket.io/1/websocket/Kk-YHECeQhkpuBBlDvGN
debug: set heartbeat interval for client Kk-YHECeQhkpuBBlDvGN
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
that`s all
oncesk
@oncesk
Oct 05 2015 17:34
so, with server all fine but on client we have error
warn: handshake error NO COOKIE TRANSMITTED for /client
what in you browser console?
do you have any error?
Doru Popescu
@dorw123
Oct 05 2015 17:35
no error
but
1444066545487: Creating new event emitter with scope global
client.js:37 1444066545493: Attach event listener for event: invoke
client.js:37 1444066545494: Compiled event name: system:invoke
client.js:37 1444066545494: Attach event listener for event: jquery
client.js:37 1444066545495: Compiled event name: system:jquery
client.js:37 1444066545495: Attach event listener for event: newrfi
client.js:37 1444066545495: Compiled event name: global:newrfi
oncesk
@oncesk
Oct 05 2015 17:36

maybe you can add in you /etc/hosts

192.168.1.119 didsecure.noip.me

and run nodejs with domain
Doru Popescu
@dorw123
Oct 05 2015 17:37
I`m not getting int afterLogin
function
protected function afterLogin($fromCookie) {
var_dump("here");
die;
parent::afterLogin($fromCookie);
    $frame = Yii::$app->nodeSocket->getFrameFactory()->createAuthenticationFrame();
    $frame->setUserId($this->getId());
    $frame->send();
}
never dies.
oncesk
@oncesk
Oct 05 2015 17:39
so, this is yii behaviour, i do not know why
as i tell you before i am not using yii now
sorry)
i do not know what you need to do for fixing this
Doru Popescu
@dorw123
Oct 05 2015 17:54
i managed to make it work... but still cannot seem to do nothing on event
dunno why
oncesk
@oncesk
Oct 05 2015 17:55
seems like cookie not sent?
do you can use domain or subdomain?
Doru Popescu
@dorw123
Oct 05 2015 18:16
I`d rather die than let this not working
oncesk
@oncesk
Oct 05 2015 18:17
))))
i do not understand why you can not use one domain or one domain and subdomains
Doru Popescu
@dorw123
Oct 05 2015 18:25
this doesn`t matter...the error is no cookie transmitted
wtf... where is the cookie transmitted?
oncesk
@oncesk
Oct 05 2015 18:25
you have different domains
this is the reason
you need to load socket.io.js from your domain not ip
and connect to the domain
Doru Popescu
@dorw123
Oct 05 2015 18:27
so... where to set it?
so, you need right configuration
Doru Popescu
@dorw123
Oct 05 2015 18:28
ok... you-re saying
oncesk
@oncesk
Oct 05 2015 18:28
you have backend, frontend and nodejs
Doru Popescu
@dorw123
Oct 05 2015 18:28
ok... let`s say
i will disable
oncesk
@oncesk
Oct 05 2015 18:29
you want use different domains for backend and frontend
?
Doru Popescu
@dorw123
Oct 05 2015 18:29
my vhost to default
so... it points to the ip
will it work then?
let`s try
oncesk
@oncesk
Oct 05 2015 18:30
socket.io.js must connecting to the same domain as in your browser in other case cookie will not sent
you need configure your domains
why you can not set up nodejs server on the same domain?
Doru Popescu
@dorw123
Oct 05 2015 18:33
because my domain is dynamic through a router
so the router redirects :80 requests to an IP
pfff... man
you`re great
YOU`RE FUCKING GREAT
thank
it`s working now
i disabled the domains
oncesk
@oncesk
Oct 05 2015 18:37
good))