Comparing version 4.0.0 to 5.0.0
@@ -20,5 +20,5 @@ const isBrowser = (typeof WebSocket !== 'undefined'); | ||
if (handle && handle.readyState === 1) | ||
handle.send(Buffer.from(payload)); | ||
handle.send(typeof payload === 'string' ? payload : JSON.stringify(payload)); | ||
else | ||
handle._queue.push(payload); | ||
handle._queue.push(JSON.stringify(payload)); | ||
} | ||
@@ -35,8 +35,8 @@ function stop() { | ||
connection._queue = []; | ||
connection[evtType]('message', evt => emitter.emit('rawFrame', Buffer.from(evt.data || evt))); | ||
connection[evtType]('message', evt => emitter.emit('frame', JSON.parse(evt.data || evt), (evt.data || evt).length)); | ||
connection[evtType]('error', err => emitter.emit('error', err)); | ||
connection[evtType]('close', () => emitter.emit('disconnect')); | ||
connection[evtType]('open', () => { | ||
emitter.emit('connect', connection); | ||
connection._queue.forEach(payload => send(connection, payload)); | ||
emitter.emit('connect', connection); | ||
}); | ||
@@ -43,0 +43,0 @@ return connection; |
# 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/ws", | ||
"version": "4.0.0", | ||
"version": "5.0.0", | ||
"description": "WebSocket transport for Kalm", | ||
@@ -5,0 +5,0 @@ "main": "bin/ws.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
11064