javascript - connect event is not firing -
i new socket.io, node.js, , javascript in general. building real-time web application partner summer research project.
my question: able have 'connect' event , 'connection' event on server side? have not been able fire connect event client side have been able fire other event server side.
secondary question: 'connect'/'connection'/'disconnect' native events language , there others?
third question: 'connect' , 'connection' event same thing?
var path = require('path'); var express = require('express'); var app = express(); var http = require('http').server(app); var io = require('socket.io')(http); app.use(express.static(__dirname)); io.on('connection', function(socket) { console.log('user connected from: ' + socket.id); socket.on("connect", function(messageplayername) { console.log(messageplayername); }); socket.on("disconnect", function() { console.log('user disconnected'); }); }); http.listen(3000, function(){ console.log('listenening on *: 3000'); });
i can respond first , third question : yes there same written here in section event. on server side can listen 1 of theme.
to second question : these event fired socket.io , not js native.
Comments
Post a Comment