Skip to content

Done function executes for each root object instead of final object response #224

Description

@rahultailwal

Hi, I have an api where we have direct root json objects like below. I have to fetch each object data from the api and push into array and also want to know when all data is completed. Basically its Newline delimited JSON streaming

{id : 1, name: 'Test1'}
{id : 2, name: 'Test1'}
{id : 3, name: 'Test1'}
{id : 4, name: 'Test1'}

I am using rsjx with oboe to do that. If i use the below then for each object I am getting done event called it should be printed at the end of 4th json object. How can we achieve this with Oboe, In the given examples there is no example for direct json object all are within some json object array or normal text. Please update

import { Observable } from 'rxjs'
import oboe from 'oboe'

const oboeService = {
streamObservable(input) {
return new Observable(obs => {
const stream = oboe(input)
stream.node('!', data => obs.next(data))
stream.done(() => console.log('donedd')) // To test when done is printed
stream.fail(e => obs.error(e))
})
},
}
export default oboeService

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions