refactor(client): simplify the code

From the stream doc: "If [onData] is null, nothing happens"