The connection events get fired as soon as the TCP connection is established. There's no way to send anything in between.
What you can do is to simply take the first message send by the server and put the data in that message. I'd strongly suggest to roll some thin protocol for this, so you would have multiple types of messages and use those to determine how the code should process the data.
This would be more extendable too, since it's fairly easy to come up with a generic architecture for that. If you want to wait for the userdata to come in first you can simply add some state to your connections.
//client side
var socket = io.connect(window.location.origin,{query:'loggeduser=user1'});
// server side
io.socket.on('connection', function (socket) {
console.log("loggeduser => " + socket.handshake.query.loggeduser);
});
Using querystrings to send sensitive data is not a good security practice (why?).
I think that if you need to send non-sensitive data, then Miquel answer is the fastest and more easy one, but if sensitive data is what you need to send, then something like Daniel W. is the best approach to take.
For an authentication approach, you can take a look at this github project (socketio-auth) which, beyond the fact that it is currently with no maintenance, can give you a good idea of how to deal with the problem.