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

stream-url

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stream-url - npm Package Compare versions

Comparing version 0.1.0 to 0.2.1

index.js

7

package.json
{
"name": "stream-url",
"version": "0.1.0",
"version": "0.2.1",
"homepage": "http://github.com/gritzko/stream-url",

@@ -21,4 +21,3 @@ "repository": {

],
"main": "src/su.js",
"browser": "src/su.js",
"main": "index.js",
"dependencies": {

@@ -32,4 +31,4 @@ },

"scripts": {
"test": "tape test/*.js | tap-spec"
"test": "node test/*.js | tap-spec"
}
}

@@ -5,31 +5,21 @@ Stream URLs

The package aims to unite two powerful universal concepts: streams and
URLs. It is mostly driven by desire to create modular distributed
applications connected by asynchronous interfaces.
Consider typical microservices. Those are connected by HTTP
request-response calls thus emulating a synchronous call graph in a
fundamentally asynchronous environment. Stream-connected
architectures can be seen as distributed [go channels][go] instead.
URLs. `stream-url` encapsulates details of a particular medium and allows
the app to open *data streams to URLs*.
stream-url is a syntactic sugar, in a sense, but it definitely helps to
clear a subsystem's code out of technical details and make it easily
pluggable.
Streams allow to pipeline operations, provide flow control, and, most
importantly, the concept of a stream is universal enough to use in
very different settings.
```
var su = require('stream-url');
// TCP server
var tcp_server = su.listen('tcp://localhost:1234', (err, serv) => {
serv.on('connection', stream => {
...
// stdin/stdout "client"
su.connect('std:', (err, stream) => {
...
```
For example, one may use loopback streams for testing, filesystem sockets
to connect local processes, WebSockets to pass data over the internet
and raw TCP streams for low-overhead inner network transmissions.
Considering isomorphic apps, inside the browser one may use postMessage
(frame to frame) or WebStorage (tab to tab) based streams.
This approach fits event sourcing architectures extremely well, as
all app's events are well serializable then.
So, stream-url encapsulates details of a particular medium and allows
the app to open *data streams to URLs*.
stream-url is a syntactic sugar, in a sense, or maybe even syntactic
cocaine, but it definitely helps to clear a subsystem's code out of
technical details and make it easily pluggable.
Just replace `loopback://random_key` for `ws://myserver.com` or
`tcp://10.10.10.10:1234` and the component/micro-service now works in
a different setting.
[![Build Status](https://travis-ci.org/gritzko/stream-url.svg?branch=master)](https://travis-ci.org/gritzko/stream-url)

@@ -58,10 +48,8 @@

introduce non-trivial dependencies.
- [x] [server-side WebSocket][su-ws]
- [x] [TCP][su-node]
- [ ] [HTTP][su-node]
- [ ] [filesystem sockets][su-node]
- [ ] [stdin/stdout][su-node]
- [ ] [client-side WebSocket][su-bro]
- [ ] [postMessage][su-bro]
- [ ] [WebStorage][su-bro]
- [x] [filesystem sockets][su-node]
- [x] [stdin/stdout][su-node]
- [x] [loopback streams][swarm-bat]

@@ -74,3 +62,2 @@

[su-node]: https://github.com/gritzko/stream-url-node
[su-bro]: https://github.com/gritzko/stream-url-browser
[swarm-bat]: https://github.com/gritzko/swarm

@@ -109,6 +109,3 @@ "use strict";

} else {
console.error('server not known: '+srv_id);
if (callback) {
callback("server not known");
}
callback && callback("server not known");
}

@@ -115,0 +112,0 @@ } else {

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