Comparing version 1.7.3 to 1.7.4
@@ -5,2 +5,8 @@ # Changelog | ||
## [1.7.4][] - 2021-06-26 | ||
- Update Metacom exports | ||
- Throw errors on wrong configs | ||
- Update Client implementation in /distr | ||
## [1.7.3][] - 2021-06-08 | ||
@@ -103,3 +109,4 @@ | ||
[unreleased]: https://github.com/metarhia/metacom/compare/v1.7.3...HEAD | ||
[unreleased]: https://github.com/metarhia/metacom/compare/v1.7.4...HEAD | ||
[1.7.4]: https://github.com/metarhia/metacom/compare/v1.7.3...v1.7.4 | ||
[1.7.3]: https://github.com/metarhia/metacom/compare/v1.7.2...v1.7.3 | ||
@@ -106,0 +113,0 @@ [1.7.2]: https://github.com/metarhia/metacom/compare/v1.7.1...v1.7.2 |
@@ -48,2 +48,3 @@ import { EventEmitter } from './events.js'; | ||
this.calls = new Map(); | ||
this.streams = new Map(); | ||
this.active = false; | ||
@@ -93,2 +94,19 @@ this.connected = false; | ||
} | ||
if (callType === 'stream') { | ||
const { name, size, status } = packet; | ||
if (name) { | ||
const stream = { name, size, chunks: [], received: 0 }; | ||
this.streams.set(callId, stream); | ||
return; | ||
} | ||
const stream = this.streams.get(callId); | ||
if (status) { | ||
this.streams.delete(callId); | ||
const blob = new Blob(stream.chunks); | ||
blob.text().then((text) => { | ||
console.log({ text }); | ||
}); | ||
return; | ||
} | ||
} | ||
} | ||
@@ -145,3 +163,6 @@ } | ||
socket.addEventListener('message', ({ data }) => { | ||
this.message(data); | ||
if (typeof data === 'string') { | ||
this.message(data); | ||
return; | ||
} | ||
}); | ||
@@ -148,0 +169,0 @@ |
@@ -25,2 +25,3 @@ 'use strict'; | ||
constructor(config, application) { | ||
if (threadId === 0) throw new Error(`Thread 0 is intended for system use`); | ||
this.config = config; | ||
@@ -33,3 +34,5 @@ this.application = application; | ||
const skipBalancer = balancer ? 1 : 0; | ||
this.port = this.balancer ? balancer : ports[threadId - skipBalancer - 1]; | ||
const port = this.balancer ? balancer : ports[threadId - skipBalancer - 1]; | ||
if (!port) throw new Error(`No port configured thread ${threadId}`); | ||
this.port = port; | ||
this.server = null; | ||
@@ -36,0 +39,0 @@ this.ws = null; |
@@ -7,4 +7,4 @@ 'use strict'; | ||
module.exports = Metacom; | ||
module.exports.Metacom = Metacom; | ||
module.exports.Server = Server; | ||
module.exports.Channel = Channel; |
{ | ||
"name": "metacom", | ||
"version": "1.7.3", | ||
"version": "1.7.4", | ||
"author": "Timur Shemsedinov <timur.shemsedinov@gmail.com>", | ||
@@ -57,8 +57,8 @@ "description": "Communication protocol for Metarhia stack with rpc, events, binary streams, memory and db access", | ||
"metautil": "^3.5.4", | ||
"ws": "^7.4.6" | ||
"ws": "^7.5.0" | ||
}, | ||
"devDependencies": { | ||
"@types/ws": "^7.4.4", | ||
"@types/node": "^15.6.2", | ||
"eslint": "^7.27.0", | ||
"@types/node": "^15.12.4", | ||
"@types/ws": "^7.4.5", | ||
"eslint": "^7.29.0", | ||
"eslint-config-metarhia": "^7.0.1", | ||
@@ -69,5 +69,5 @@ "eslint-config-prettier": "^8.3.0", | ||
"metatests": "^0.7.2", | ||
"prettier": "^2.3.0", | ||
"typescript": "^4.3.2" | ||
"prettier": "^2.3.2", | ||
"typescript": "^4.3.4" | ||
} | ||
} |
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
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
33153
811
Updatedws@^7.5.0