Client:
var socket = io.connect();
socket.on('some stuff', function(){
console.log("Please please work.");
});
Server:
var io = require('socket.io').listen(app);
io.sockets.on('connection', function(socket){
console.log("Yay, tab opened!");
socket.on('disconnect', function(){
console.log("Aww, tab closed. ");
});
socket.on('some stuff', function(){
console.log("Did it work? Idk.");
});
});
App is just a server which is irrelevant. When I run it, the only part that works is the tab open tab closed part. When I open up localhost and go on there, it says "yay tab opened" in the windows console. (And when I open more tabs, it says that message for every tab I open). When I close tabs, it says the aww tab closed message for every tab I close.
BUT when I am trying to add my own function, it doesn't care to log in. I realize that I'm not doing anything with that function yet, but I will need it later on. So I want to know why it's not logging it. The disconnect works, but the "some stuff" doesn't work. Why not?