-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bumped ws to v2.0.0. #106
Bumped ws to v2.0.0. #106
Conversation
Don't you prefer to stay at next https://github.com/websockets/ws/releases/tag/1.1.2 ? |
At some point we will have to migrate to v2. |
https://github.com/websockets/ws/releases/tag/2.0.0
Man, AWS lambda is stuck on 4.3.2, they need to get their act together. |
Linked here from @mcollina My 2 cents: I understand the issue and the effort involved. While my understanding of this module is limited as I'm using one which depends on this, there is a very long stack trace appearing in the console coming from v8 directly, when using Node v6+, to say that the version of We faced a lot of errors and crashes in Node v7 when trying to use the module, and ultimately couldn't get it to work. I realise the drop in support is not ideal, but it may become necessary very soon. |
@simonmcl we are not using |
@mcollina But when trying to use https://www.npmjs.com/package/ibmiotf , on node 6.9.5 a large stacktrace appears warning of deprecations for I planned to ask them to update their dependencies, but discovered that there was no version of ... anyone else's head hurting or just me? |
@simonmcl So, something else should be going on in here. I think you should open an issue on ibmiotf, and we can work with them to solve the issue. They probably have more bandwidth than us anyway. |
@mcollina ah its a |
@mcollina had another few minutes to look at this. Turns out the versions being used by that IOT module, is using a version of Logged an issue with the IOT module to update their versions. Thanks for the help debugging this! |
U using aws IoT too?
|
@sublimator no IBM's IOT platform on Bluemix |
I saw aws/azure use mqtt 1.x (though not sure about the latter)
|
ws 2 does not work on aws ... they are still on node 4.3.2 ...
|
@sublimator 4.3.2? jesus thats horrific, my thoughts and prayers are with you at this difficult time lol |
Hahaha
|
FWIW aws now (Mar 22nd, 2017) supports and recommends Node.js v6.10 |
Yeah, aws 6.10!
|
Still, a lot of people uses older version of v4. Can we get ws to work on v4.0.0? Lamda's node 4.3.2 is still there for a lot of people. |
Node.js v4.5 is only required due to the use of safe Buffer APIs only available is 4.5+ but we can use https://www.npmjs.com/package/safe-buffer in ws to support all v4 versions. |
stream.js
Outdated
@@ -17,7 +17,7 @@ function WebSocketStream(target, protocols, options) { | |||
if (protocols && !Array.isArray(protocols) && 'object' === typeof protocols) { | |||
// accept the "options" Object as the 2nd argument | |||
options = protocols | |||
protocols = null | |||
protocols = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is no longer needed. It was a regression bug which has been fixed in ws@2.2.3
, sorry about that.
@@ -67,6 +67,13 @@ function WebSocketStream(target, protocols, options) { | |||
var coerceToBuffer = options.binary || options.binary === undefined | |||
|
|||
function socketWriteNode(chunk, enc, next) { | |||
// avoid errors, this never happens unless | |||
// destroy() is called | |||
if (socket.readyState !== WS.OPEN) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I thought this has nothing to do ws@2
, it is also needed for ws@1
. The same issue also happens on master if you disable the permessage-deflate extension.
diff --git a/test.js b/test.js
index 18caa28..a0b10af 100644
--- a/test.js
+++ b/test.js
@@ -99,7 +99,9 @@ test('drain', function(t) {
t.plan(1)
echo.start(function() {
- var client = websocket(echo.url, echo.options)
+ var client = websocket(echo.url, {
+ perMessageDeflate: false
+ })
client.on('drain', function() {
client.destroy()
In ws@2
this also happens with permessage-deflate enabled because data is not compressed unless the size is bigger than a configurable threshold (1024 bytes by default).
The problem with the "drain" test is that a single data chunk arrives on the server with many binary frames and a close frame. All frames are parsed on the same tick and when the close frame is processed, the readyState
is set to CLOSING
. The payloads of the processed binary frames are pushed to the proxy, but when socketWriteNode()
is called the readyState
is already CLOSING
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the explanation.
readme.md
Outdated
extension](https://tools.ietf.org/html/rfc7692) to achieve the best | ||
throughput. | ||
|
||
Default: `false` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lpinca is this documented correctly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default value is true
in ws
.
readme.md
Outdated
extension](https://tools.ietf.org/html/rfc7692) to achieve the best | ||
throughput. | ||
|
||
Default: `false` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default value is true
in ws
.
fs.createReadStream('bigdata.json').pipe(stream) | ||
} | ||
``` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might makes sense to show how to disable it on the client (it's the same) as websocket-stream
could be used only as a client.
@lpinca is the |
@lpinca forget about that question, we are not passing the options through. |
The are no options in the browser interface. It depends on the browser. It is automatically negotiated when supported (if the server supports it ofc). |
Fixes #105.
This is a semver-major change, as it will work only on Node v4+.