v4.0.0-alpha.0
Pre-release
Pre-release
darrachequesne
released this
13 Feb 06:43
·
87 commits
to master
since this release
Features
- decrease the default value of maxHttpBufferSize (734f9d1)
- disable cookie by default and add sameSite attribute (a374471), closes /github.com/jshttp/cookie#options-1
- generateId method can now return a Promise (f3c291f)
- reverse the ping-pong mechanism (31ff875)
- use the cors module to handle cross-origin requests (61b9492)
BREAKING CHANGES
- the handlePreflightRequest option is removed by the change.
Before:
new Server({
handlePreflightRequest: (req, res) => {
res.writeHead(200, {
"Access-Control-Allow-Origin": 'https://example.com',
"Access-Control-Allow-Methods": 'GET',
"Access-Control-Allow-Headers": 'Authorization',
"Access-Control-Allow-Credentials": true
});
res.end();
}
})
After:
new Server({
cors: {
origin: "https://example.com",
methods: ["GET"],
allowedHeaders: ["Authorization"],
credentials: true
}
})
- the syntax has changed from
new Server({
cookieName: "test",
cookieHttpOnly: false,
cookiePath: "/custom"
})
to
new Server({
cookie: {
name: "test",
httpOnly: false,
path: "/custom"
}
})
All other options (domain, maxAge, sameSite, ...) are now supported.
- v3.x clients will not be able to connect anymore (they will send a ping packet and timeout while waiting for a pong packet).
Links
- Diff: 3.4.0...v4.0.0-alpha.0
- Client release: v4.0.0-alpha.0
- ws version: ^7.1.2