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

stream-url-ws

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stream-url-ws

[![Build Status](https://travis-ci.org/gritzko/stream-url-ws.svg?branch=master)](https://travis-ci.org/gritzko/stream-url-ws)

  • 0.1.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
Maintainers
1
Weekly downloads
 
Created
Source

WebSocket adapter for stream-url

Build Status

stream-url marries streams and urls. API user can start a server or a client connection using an ultra-compact universal interface of two methods: listen and connect. Underlying implementation relies on websocket-stream

// Server

var su = require('stream-url-ws');

// start a WebSocket echo server
var server = su.listen ('ws://localhost:1234', function ready() {

    server.on('stream', function (stream) {

        stream.on('data', stream.write.bind(stream));

    })

});


// Client

var su = require('stream-url-ws');

var stream = su.connect('ws://localhost:1234', function ready() {

    stream.on ('data', function log (data) {
        console.log(''+data);
        stream.end();
    });

    stream.write('Hello world!');

});

API

Client handle is a duplex stream with additional connect event. Server implements websocket server events but connection carries a stream rather than a websocket.

FAQs

Package last updated on 31 Dec 2015

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