Update query string parameter at socket.io reconnect

I analyzed the socket object and found the solution, therefore I am answering my own question.

The query string is stored inside socket.socket.options.query. You can change it to the desired value directly before reconnecting.

socket.socket.options.query = 'i='+env.id;
socket.socket.connect();

In the current version of socket.io (at the moment of writing is 1.3.7) you should use

socket.io.opts.query = 'i='+env.id;

But be careful of using this due this bug