Set function for BC

And also some tests.

Is this what you had in mind, @guille?

Eventually this PR might lead to the BC that was discussed in https://github.com/LearnBoost/socket.io/issues/1463