Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

http-observable

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

http-observable

Node.js http module binding using the Reactive Extensions for JavaScript (RxJS) Observable to handle stream http response

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

http-observable

A simple RxJs Observable binding for Node.js http module. This observable is useful to handle streaming http response.

This module is a work in progress. TODO list:

  • status() - To find out the status of the http/https calls
  • headers() - To get the observable result on response headers
  • body() - Body parse and read response Body
  • Methods get and post and generic request
  • SSL validations
  • Socket and connect timeout implementations

Install

npm i http-observable

Usage


    var HttpObservable = require('http-observable');

    // Http Request options
    // https://nodejs.org/api/http.html#http_http_request_options_callback
    //
    var options = {
        hostname: 'somestreamingapi.com',
        port: 80,
        path: '/stream'
    };

    var response = HttpObservable(options).request();
    
        response.body().subscribe(
              function onNext(chunk) {
                  //Write the data chunk to response stream (Or process the data)
                  res.write(chunk);
              },
              function onError() {
                  //Handle errors here.
                  res.write('error');
              },
              function onCompleted() {
                  //End of streaming data. Write the end response (Or equivalent tasks)
                  res.end('</body></html>');
              }
        );

Options

https://nodejs.org/api/http.html#http_http_request_options_callback

Example

https://github.com/subii/express-streaming-app

Keywords

FAQs

Package last updated on 29 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc