added onError
each connection has its own buffer now