use buffer length, not string length

partial fix for https://github.com/LearnBoost/engine.io/issues/244