Streaming in computer science is a trendy term and refers to the transfer of data over time in the form of chunks. We need streaming when we want to send a large object. We divide the object into smaller chunks and send them one by one.
The most widely implemented applications of streaming are as follows:
When watching a video stream in a browser, we don't expect the video to download and then watch the video. If that were the case, downloading a video would take a noticeable time, even with a fast internet connection. To avoid this delay, the video is downloaded in small chunks. And the user won't even notice as long as the download is happening quicker than the playback.
The same case is for close-circuit television (CCTV) cameras where the video is continuous and voice calls where we don't know when the call will end.
SingalR supports two types of streaming:
In this type of streaming, we open a stream from the client. The client keeps sending the messages via stream until the client runs out of messages or closes the stream.
The client fully controls the stream. The server can forcefully stop the stream if needed, but the client will stop it under normal circumstances.
As the name suggests, server streaming is the opposite of client streaming. In this type of streaming, the server sends messages to the client. The client still needs to initiate the server streaming endpoint on the server. But once the stream is initiated and the client has subscribed to it, it will keep reading the messages from the server until no more messages are left, or the server disconnects the stream.
Free Resources