Comparing version 4.0.0 to 5.0.0
@@ -19,3 +19,3 @@ "use strict"; | ||
for (let i = 0; i < clientCache[key].data.length; i++) { | ||
clientCache[key].client.emit('frame', clientCache[key].data[i]); | ||
clientCache[key].client.emit('frame', JSON.parse(clientCache[key].data[i].toString()), clientCache[key].data[i].length); | ||
} | ||
@@ -28,4 +28,4 @@ clientCache[key].data.length = 0; | ||
function send(handle, payload) { | ||
if (handle) { | ||
handle.socket.send(Buffer.from(payload), handle.port, handle.host); | ||
if (handle && handle.socket) { | ||
handle.socket.send(JSON.stringify(payload), handle.port, handle.host); | ||
} | ||
@@ -35,2 +35,3 @@ } | ||
listener.close(); | ||
listener = null; | ||
} | ||
@@ -54,3 +55,3 @@ function disconnect(handle) { | ||
else | ||
emitter.emit('rawFrame', req); | ||
emitter.emit('frame', JSON.parse(req.toString()), req.length); | ||
}); | ||
@@ -63,3 +64,3 @@ connection.bind(null, localAddr); | ||
}; | ||
send(res, Buffer.from('SYN')); | ||
send(res, 'SYN'); | ||
timeout = setTimeout(() => disconnect(res), connectTimeout); | ||
@@ -76,3 +77,3 @@ return res; | ||
if (data[0] === 83 && data[1] === 89 && data[2] === 78) { | ||
send(handle, Buffer.from('ACK')); | ||
send(handle, 'ACK'); | ||
isSynPacket = true; | ||
@@ -92,3 +93,3 @@ } | ||
if (clientCache[key].client) | ||
clientCache[key].client.emit('rawFrame', data); | ||
clientCache[key].client.emit('frame', JSON.parse(data.toString())); | ||
else | ||
@@ -105,3 +106,4 @@ clientCache[key].data.push(data); | ||
} | ||
emitter.on('connection', addClient); | ||
if (emitter && typeof emitter.on === 'function') | ||
emitter.on('connection', addClient); | ||
return { | ||
@@ -108,0 +110,0 @@ bind, |
# Changelog | ||
## [v4.0.0] - 2020-03-28 | ||
## [v5.0.0] - 2020-06-23 | ||
commit: [731491d](https://github.com/kalm/kalm.js/commit/731491d7b98f3116e0491905c99f9ece29d24d65) | ||
commit: [#](https://github.com/kalm/kalm.js/commits) | ||
## Breaking changes | ||
- Changed default packet framing to be a pure json object | ||
- Removed custom framing | ||
- Added packet message cap | ||
- Fixed multiplexing | ||
@@ -15,2 +18,13 @@ ## Added | ||
## [v4.0.0] - 2020-03-28 | ||
commit: [731491d](https://github.com/kalm/kalm.js/commit/731491d7b98f3116e0491905c99f9ece29d24d65) | ||
## Added | ||
- Added more error messages | ||
- Added tests for transport packages | ||
- Added CHANGELOG and LICENSE to all packages | ||
- Added 'framing' option to set packet framing to be a pure json object | ||
## [v3.3.0] - 2020-01-30 | ||
@@ -17,0 +31,0 @@ |
{ | ||
"name": "@kalm/udp", | ||
"version": "4.0.0", | ||
"version": "5.0.0", | ||
"description": "UDP transport for Kalm", | ||
@@ -5,0 +5,0 @@ "main": "bin/udp.js", |
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
12789
141