I have in my Express
server
userbase = {'Fitz': '84Iw3MNEIMaed0GoAAAD'}; //Exapmle user to receive message and associated socket id
//Sending message to Example user
socket.on('send_msg',function(data_from_client){
//Testing for receivers socketId
console.log(userbase[data_from_client.to_user]);//This returns the socket id for Fitz in userbase successfully i.e 84Iw3MNEIMaed0GoAAAD
socket.broadcast.to(userbase[data_from_client.to_user]).emit('get_msg',{msg:data_server.msg});
});
Surprise surprise when I setup a handler for this event on my cliens side for 'get_msg'
i get nothing.
.factory('SocketFctry',function(){
var socket = io('http://localhost:3002')
return socket;
})
.controller('ChatCtrl', function($scope,SocketFctry) {
SocketFctry.on('get_msg',function(received_message){
console.log(received_message);
$scope.$apply();
})
});
My other client side handlers are working fine.
SocketFctry.on('new_user', function(users,my_id){
console.log(users);
$scope.online_users = users;
$scope.$apply();
})
My version of socket.io is 1.3.7 .Am I missing something here?