JSON Streaming in React Native

I'm building a React Native app that has to listen on a JSON stream, something similar to node's JSONStream/EventStream style (https://www.npmjs.com/package/JSONStream) . Packages like JSONStream can't get imported into React Native due to platform issues. Does anyone have suggestions on how to do the equivalent streaming in react native?

The way it works in Node is:

var request = require('request');
var JSONStream = require('JSONStream');
var es = require('event-stream');

request(options) 
    .pipe(JSONStream.parse('*')) 
    .pipe(es.map(function(message) { 
      handle(message) 
    }));

Comments

Popular posts from this blog

flutter websocket connection issue

Webpack 5 and Storybook 6 integration throws an error in DefinePlugin.js

Meaning of `{}` for return expression