JSON Streaming in React Native

I am creating a React Native application that should listen on a JSON stream, something similar to the node style JSONStream / EventStream ( https://www.npmjs.com/package/JSONStream ). Packages such as JSONStream cannot be imported into React Native due to platform issues. Does anyone have any suggestions on how to do equivalent streaming according to native?

Way to work in node:

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) 
    }));
+4
source share

Source: https://habr.com/ru/post/1649810/


All Articles