stream-url
Advanced tools
Comparing version 0.1.0 to 0.2.1
{ | ||
"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 { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20700
14
544
61
1
2