open event not emitted on connection
arthurmougin opened this issue · 2 comments
arthurmougin commented
Unexpected behavior :
app.ws('/',function(ws,req){
console.log('socket requested\n');
ws.on('open',function(){
console.log("new connection.");
ws.send("welcome");
});
ws.on('message',function (data) {
console.log("message:" ,data);
ws.send(data);
})
....
On the first connection and after the first message, this code echoed only
socket requested
// expected : new connection.
message: {"message":"message emitted"}
while the open event should be emitted between those 2 logs.
Tested on Ubuntu on a Dell and rapsbian on rpi3B+
ruettenm commented
I've the same issue
brian221 commented
I was struggling with the same issue/concept. The initial connection where 'socked requested' is logged in your example above IS the open event. The open event emission is abstracted from the underlying ws
implementation.
app.ws('/',function(ws,req){
console.log('socket requested\n');
console.log("new connection.");
ws.send("welcome");
ws.on('message',function (data) {
console.log("message:" ,data);
ws.send(data);
})
....