Is it possible to send streaming data from WEB API to Angular ?like in open AI there is option to show data as stream it will give data in bit by bit this we can able to do in console application but can't able to do using WEB API and Angular. Here my requirement is to send Open AI Streaming response to Angular.
How to send Open AI Streaming data from WEB API to Angualr
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Praveen Mishra183 reputationPosted Jul 13, 2023, 3:42 AM EDT
Here is the code to send OpenAI Streaming data from a web API to an Angular application:
import { Component } from '@angular/core';
import { HttpClient } from '@angular/common/http';
@Component({
selector: 'app-your-component',
templateUrl: './your-component.component.html',
styleUrls: ['./your-component.component.css']
})
export class YourComponent {
constructor(private http: HttpClient) {}
fetchData() {
this.http.get('your-api-endpoint-url').subscribe(
(response) => {
// Handle the response data
console.log(response);
},
(error) => {
// Handle any errors
console.error(error);
}
);
}
}