@signalk/streams 2.1.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/mdns-ws.js CHANGED
@@ -66,6 +66,7 @@ function MdnsWs(options) {
66
66
  autoConnect: false,
67
67
  deltaStreamBehaviour,
68
68
  rejectUnauthorized: !(options.selfsignedcert === true),
69
+ wsKeepaliveInterval: 10
69
70
  })
70
71
  this.connect(this.signalkClient)
71
72
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signalk/streams",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "Utilities for handling streams of Signal K data",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -23,7 +23,7 @@
23
23
  "homepage": "https://github.com/SignalK/signalk-server-node#readme",
24
24
  "dependencies": {
25
25
  "@canboat/canboatjs": "^1.4.0",
26
- "@signalk/client": "^2.1.0",
26
+ "@signalk/client": "^2.3.0",
27
27
  "@signalk/n2k-signalk": "^2.0.0",
28
28
  "@signalk/nmea0183-signalk": "^3.0.0",
29
29
  "@signalk/nmea0183-utilities": "^0.8.0",
package/simple.js CHANGED
@@ -253,7 +253,13 @@ function nmea2000input(subOptions, logging) {
253
253
  new Liner(subOptions),
254
254
  ]
255
255
  } else if (subOptions.type === 'ydwg02-udp-canboatjs') {
256
- return [new Udp(subOptions), new Liner(subOptions)]
256
+ return [
257
+ new Udp({
258
+ ...subOptions,
259
+ outEvent: 'ydwg02-out',
260
+ }),
261
+ new Liner(subOptions),
262
+ ]
257
263
  } else if (subOptions.type === 'navlink2-tcp-canboatjs') {
258
264
  return [
259
265
  new Tcp({
package/udp.js CHANGED
@@ -41,6 +41,9 @@ function Udp(options) {
41
41
  })
42
42
  this.options = options
43
43
  this.debug = (options.createDebug || require('debug'))('signalk:streams:udp')
44
+ this.debugData = (options.createDebug || require('debug'))(
45
+ 'signalk:streams:udp-data'
46
+ )
44
47
  }
45
48
 
46
49
  require('util').inherits(Udp, Transform)
@@ -51,11 +54,21 @@ Udp.prototype.pipe = function (pipeTo) {
51
54
 
52
55
  const socket = require('dgram').createSocket('udp4')
53
56
  const self = this
57
+
58
+ if (this.options.outEvent && this.options.port !== undefined) {
59
+ this.options.app.on(this.options.outEvent, function (d) {
60
+ self.debug('sending over udp: %s', d)
61
+ socket.send(d, 0, d.length, self.options.port, '255.255.255.255')
62
+ })
63
+ }
64
+
54
65
  socket.on('message', function (message, remote) {
55
66
  self.debug(message.toString())
56
67
  self.push(message)
57
68
  })
58
- socket.bind(this.options.port)
69
+ socket.bind(this.options.port, function () {
70
+ socket.setBroadcast(true)
71
+ })
59
72
  }
60
73
 
61
74
  Udp.prototype._transform = function (chunk, encoding, done) {