created send data function for the streaming protocol