mos-connection
Advanced tools
Comparing version 0.8.0 to 0.8.1
@@ -5,8 +5,8 @@ # Change Log | ||
# [0.8.0](https://github.com/nrkno/tv-automation-mos-connection/compare/0.7.0...0.8.0) (2019-04-10) | ||
## [0.8.1](https://github.com/nrkno/tv-automation-mos-connection/compare/0.8.0...0.8.1) (2019-04-11) | ||
### Features | ||
### Bug Fixes | ||
* **mosExternalMetadata:** adds a very specific parser to eliminate known errors [in ENPS?] with some number values coming through as localized strings ([7ec7491](https://github.com/nrkno/tv-automation-mos-connection/commit/7ec7491)) | ||
* don't send heartbeat on query port ([fd1219f](https://github.com/nrkno/tv-automation-mos-connection/commit/fd1219f)) | ||
@@ -13,0 +13,0 @@ |
@@ -7,2 +7,3 @@ /// <reference types="node" /> | ||
export interface ClientDescription { | ||
useHeartbeats: boolean; | ||
heartbeatConnected: boolean; | ||
@@ -35,3 +36,3 @@ client: MosSocketClient; | ||
constructor(id: string, host: string, mosID: string, timeout?: number, debug?: boolean); | ||
createClient(clientID: string, port: number, clientDescription: ConnectionType): void; | ||
createClient(clientID: string, port: number, clientDescription: ConnectionType, useHeartbeats: boolean): void; | ||
/** */ | ||
@@ -38,0 +39,0 @@ removeClient(clientID: string): void; |
@@ -24,3 +24,3 @@ "use strict"; | ||
} | ||
createClient(clientID, port, clientDescription) { | ||
createClient(clientID, port, clientDescription, useHeartbeats) { | ||
let client = new mosSocketClient_1.MosSocketClient(this._host, port, clientDescription, this._timeout, this._debug); | ||
@@ -30,2 +30,3 @@ if (this._debug) | ||
this._clients[clientID] = { | ||
useHeartbeats: useHeartbeats, | ||
heartbeatConnected: false, | ||
@@ -116,3 +117,3 @@ client: client, | ||
let client = this._clients[key]; | ||
if (!client.heartbeatConnected) { | ||
if (client.useHeartbeats && !client.heartbeatConnected) { | ||
connected = false; | ||
@@ -218,16 +219,21 @@ } | ||
let client = this._clients[key]; | ||
let heartbeat = new mosModel_1.HeartBeat(); | ||
heartbeat.port = this._clients[key].clientDescription; | ||
return this.executeCommand(heartbeat) | ||
.then(() => { | ||
client.heartbeatConnected = true; | ||
if (this._debug) | ||
console.log(`Heartbeat on ${this._clients[key].clientDescription} received.`); | ||
}) | ||
.catch((e) => { | ||
// probably a timeout | ||
client.heartbeatConnected = false; | ||
if (this._debug) | ||
console.log(`Heartbeat on ${this._clients[key].clientDescription}: ${e.toString()}`); | ||
}); | ||
if (client.useHeartbeats) { | ||
let heartbeat = new mosModel_1.HeartBeat(); | ||
heartbeat.port = this._clients[key].clientDescription; | ||
return this.executeCommand(heartbeat) | ||
.then(() => { | ||
client.heartbeatConnected = true; | ||
if (this._debug) | ||
console.log(`Heartbeat on ${this._clients[key].clientDescription} received.`); | ||
}) | ||
.catch((e) => { | ||
// probably a timeout | ||
client.heartbeatConnected = false; | ||
if (this._debug) | ||
console.log(`Heartbeat on ${this._clients[key].clientDescription}: ${e.toString()}`); | ||
}); | ||
} | ||
else { | ||
return Promise.resolve(); | ||
} | ||
})) | ||
@@ -234,0 +240,0 @@ .then(() => { |
@@ -71,5 +71,5 @@ "use strict"; | ||
}); | ||
primary.createClient(MosConnection.nextSocketID, MosConnection.CONNECTION_PORT_LOWER, 'lower'); | ||
primary.createClient(MosConnection.nextSocketID, MosConnection.CONNECTION_PORT_UPPER, 'upper'); | ||
primary.createClient(MosConnection.nextSocketID, MosConnection.CONNECTION_PORT_QUERY, 'query'); | ||
primary.createClient(MosConnection.nextSocketID, MosConnection.CONNECTION_PORT_LOWER, 'lower', true); | ||
primary.createClient(MosConnection.nextSocketID, MosConnection.CONNECTION_PORT_UPPER, 'upper', true); | ||
primary.createClient(MosConnection.nextSocketID, MosConnection.CONNECTION_PORT_QUERY, 'query', false); | ||
if (connectionOptions.secondary) { | ||
@@ -87,5 +87,5 @@ secondary = new NCSServerConnection_1.NCSServerConnection(connectionOptions.secondary.id, connectionOptions.secondary.host, this._conf.mosID, connectionOptions.secondary.timeout, this._debug); | ||
}); | ||
secondary.createClient(MosConnection.nextSocketID, MosConnection.CONNECTION_PORT_LOWER, 'lower'); | ||
secondary.createClient(MosConnection.nextSocketID, MosConnection.CONNECTION_PORT_UPPER, 'upper'); | ||
secondary.createClient(MosConnection.nextSocketID, MosConnection.CONNECTION_PORT_QUERY, 'query'); | ||
secondary.createClient(MosConnection.nextSocketID, MosConnection.CONNECTION_PORT_LOWER, 'lower', true); | ||
secondary.createClient(MosConnection.nextSocketID, MosConnection.CONNECTION_PORT_UPPER, 'upper', true); | ||
secondary.createClient(MosConnection.nextSocketID, MosConnection.CONNECTION_PORT_QUERY, 'query', false); | ||
} | ||
@@ -92,0 +92,0 @@ // Initialize mosDevice: |
{ | ||
"name": "mos-connection", | ||
"version": "0.8.0", | ||
"version": "0.8.1", | ||
"description": "MOS compliant TCP/IP Socket connection.", | ||
@@ -103,2 +103,5 @@ "main": "dist/index.js", | ||
}, | ||
"resolutions": { | ||
"typedoc/**/marked": "^0.6.2" | ||
}, | ||
"keywords": [ | ||
@@ -105,0 +108,0 @@ "mos", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
368963
5046