Read body segment from data buffer to socket.packageBuffer;
Buffer instance
offset read star from data
new offset of data after read
Read head segment from data to socket.headBuffer.
Buffer instance
offset read star from data
new offset of data after read
Tcp socket wrapper with package compositing. Collect the package from socket and emit a completed package with 'data' event. Uniform with ws.WebSocket interfaces.
origin socket from node.js net module
options parameter. opts.headSize size of package head opts.headHandler(headBuffer) handler for package head. caculate and return body size from head data.