Answer the question
In order to leave comments, you need to log in
How to send a socket the property value of all other sockets?
I'm picking Node,js, I've reached the Socket.IO library. I've run into a problem that I haven't been able to find a solution to yet.
The server has the following lines:
io.on('connection', function(socket){
socket.session = {};
socket.session.address = socket.handshake.address;
function setName(name){
if(name != undefined && name != ''){
socket.session.userName = name;
socket.broadcast.emit('newUser', socket.session.userName);
socket.emit('userName', socket.session.userName);
logger.info('User '+socket.session.userName+' join from IP: '+socket.session.address);
}
else
socket.emit('setName');
}
setName(null);
socket.on('setName', function(name){
if(name.length > 0)
setName(name);
else
socket.emit('setName');
});
...
}
Answer the question
In order to leave comments, you need to log in
<div class="tab-links">
<ul>
<li>
<a href="#tab1">Tab 1</a>
</li>
<li>
<a href="#tab2">Tab 2</a>
</li>
</ul>
</div>
<div class="tab-item-wrapper">
<div class="tab-item" id="tab1">Content 1</div>
<div class="tab-item" id="tab2">Content 2</div>
</div>
<div class="tab-links">
<ul>
<li>
<a href="#tab1">Tab 1</a>
</li>
<li>
<a href="#tab2">Tab 2</a>
</li>
</ul>
</div>
var tabContainers = $('.tab-item-wrapper .tab-item');
tabContainers.hide().filter(':first').show();
$('.tab-links a').click(function () {
tabContainers.hide();
tabContainers.filter(this.hash).fadeIn("slow");
$('.tab-links a').removeClass('selected');
$(this).addClass('selected');
return false;
}).filter(':first').click();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question