Introduction

In client streaming, we open a stream from the client. The client will then carry on sending messages using the stream until it runs out the messages or the stream is closed. The server will receive the messages in the same order as they arrive and within the same call context.

Under normal circumstances (i.e., if there are no failures), the client controls the stream—a server can forcibly close a stream if needed, but it’s the client that initiates a normal closure of the stream.

To make it easier to demonstrate client streaming in practice, it’s the clients that we will modify first.

Applying client streaming functionality to JavaScript client

We will not add any new HTML markup to the index page of the SignalRServer web application. Instead, we will modify the existing click handler in JavaScript.

Below, you can see the site.js file that is located inside the js folder of the wwwroot directory:

Get hands-on with 1200+ tech skills courses.