julianusti
10/13/2014 - 6:57 PM

gistfile1.js

client.on('place:bid', function (bid) {
			clients[client.id].bid = bid;

			client.emit('last:bid', {
				name: clients[client.id].name,
				bid: clients[client.id].bid
			});

			broadcastHighestBid();

			function broadcastHighestBid () {
				var highest = _.max(_.values(clients), function (client) {return + client.bid});
				//if(bid > highest.bid) {
					io.sockets.emit('highest:bid', {
						name: highest.name,
						bid: highest.bid
					});
				//}
			}
		});