Skip to content

Commit 1f5411a

Browse files
committed
chore: update changelog
1 parent 567c9fe commit 1f5411a

File tree

2 files changed

+93
-5
lines changed

2 files changed

+93
-5
lines changed

CHANGELOG.md

Lines changed: 92 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,95 @@
11
# Changelog
22

3+
## v0.3.0
4+
5+
[compare changes](https://github.com/unjs/crossws/compare/v0.2.4...v0.3.0)
6+
7+
## 🌟 What is new?
8+
9+
### Better stability
10+
11+
Crossws 0.3.x includes an overhaul of refactors, stability improvements, and new features. A new codebase and testing matrix had been implemented ([#55](https://github.com/unjs/crossws/pull/55)) to make sure all supported adapters and runtimes work as expected and are consistent with each other.
12+
13+
### Refined Peer API
14+
15+
The peer object allows easy interaction with connected WebSocket clients from server route hooks ([peer docs](https://crossws.unjs.io/guide/peer)).
16+
17+
To improve Web standards compatibility, accessing upgrade URL and headers is now possible with `peer.request.url` and `peer.request.headers` (**breaking change**), and `peer.addr` is also renamed to `peer.remoteAddress` to improve readability (**breaking change**) and support is increased across providers. You can also use new lazy-generated and secure `peer.id` (UUID v4) for various purposes including temporary sessions or persistent state.
18+
19+
Two new methods are now supported to close connected peers using `peer.close(code, reason)` and `peer.terminate()`. With this new version, you can access a standard [`WebSocket`](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket) interface using `peer.websocket`.
20+
21+
> [!NOTE]
22+
> Today many of the server runtimes don't provide a spec-compliant `WebSocket` API. Crossws uses an internal proxy to polyfill consistent access to `extensions`, `protocol`, and `readyState`. See [compatibility table](https://crossws.unjs.io/guide/peer#compatibility) for more details.
23+
24+
### Refined Message API
25+
26+
On `message` [hook](https://crossws.unjs.io/guide/hooks), you receive a message object containing data from the client ([message docs](https://crossws.unjs.io/guide/message)).
27+
28+
Parsing incoming messages can be tricky across runtimes. Message object now has stable methods `.text()`, `.json()`, `.uint8Array()`, `.arrayBuffer()`, `.blob()` to safely read message as desired format. If you need, you can also access `.rawData`, `.peer`, `.event` (if available), and lazy generated secure UUID v4 `.id`
29+
30+
### Authentication via `upgrade` hook
31+
32+
When you need to authenticate and validate WebSocket clients before they can upgrade, you can now easily use the `upgrade` hook to check incoming URLs and headers/cookies and return a Web Standard [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) in case you need to abort the upgrade.
33+
34+
### Pubsub with Deno and Cloudflare Durable Objects
35+
36+
One of the common use cases of WebSockets is pubsub. This release adds pub-sub support to [Deno provider](https://crossws.unjs.io/adapters/deno) and also you can globally broadcast messages using `ws.publish` for advanced use cases.
37+
38+
Normally with cloudflare workers, it is not possible to connect multiple peers with each other. Cloudflare [Durable Objects](https://developers.cloudflare.com/durable-objects/) (available on paid plans) allows building collaborative editing tools, interactive chat, multiplayer games, and applications that need coordination among multiple clients.
39+
40+
Crossws provides a new composable method to easily integrate WebSocket handlers with Durable Objects. Hibernation is supported out of the box to reduce billing costs when connected clients are inactive. ([durable object peer docs](https://crossws.unjs.io/adapters/cloudflare#durable-objects))
41+
42+
## Changelog
43+
44+
### 🚀 Enhancements
45+
46+
- ⚠️ Overhaul internal implementation ([#55](https://github.com/unjs/crossws/pull/55))
47+
- ⚠️ Overhaul peer and message interface ([#70](https://github.com/unjs/crossws/pull/70))
48+
- **node, uws:** Automatically detect binary message type ([#53](https://github.com/unjs/crossws/pull/53))
49+
- **peer:** Add `peer.close()` and `peer.terminate()` support ([#36](https://github.com/unjs/crossws/pull/36))
50+
- Cloudflare durable objects support ([#54](https://github.com/unjs/crossws/pull/54)) ([docs](https://crossws.unjs.io/adapters/cloudflare#durable-objects))
51+
- **deno:** Support pub/sub ([#58](https://github.com/unjs/crossws/pull/58))
52+
- Universal access to all peers ([#60](https://github.com/unjs/crossws/pull/60))
53+
- Global publish using `ws.publish` ([#61](https://github.com/unjs/crossws/pull/61))
54+
- Experimental SSE-based adapter to support websocket in limited runtimes ([#62](https://github.com/unjs/crossws/pull/62), [#66](https://github.com/unjs/crossws/pull/66), [#68](https://github.com/unjs/crossws/pull/68)) ([docs](https://crossws.unjs.io/adapters/sse)
55+
- **peer:** Use secure lazy random UUID v4 ([#64](https://github.com/unjs/crossws/pull/64))
56+
57+
### 🩹 Fixes
58+
59+
- Should not serailize binary messages ([#39](https://github.com/unjs/crossws/pull/39))
60+
- **cloudflare-durable:** Restore peer url and id after hibernation ([#71](https://github.com/unjs/crossws/pull/71))
61+
62+
### 💅 Refactors
63+
64+
- ⚠️ Move `peer.ctx` to `peer._internal` ([#59](https://github.com/unjs/crossws/pull/59))
65+
- ⚠️ Remove adapter hooks ([#72](https://github.com/unjs/crossws/pull/72))
66+
- Rename internal crossws to hooks ([bb4c917](https://github.com/unjs/crossws/commit/bb4c917))
67+
- Better internal organization ([2744f21](https://github.com/unjs/crossws/commit/2744f21))
68+
69+
### 📖 Documentation
70+
71+
[#22](https://github.com/unjs/crossws/pull/22), [76fc105](https://github.com/unjs/crossws/commit/76fc105), [7dacb00](https://github.com/unjs/crossws/commit/7dacb00), [#46](https://github.com/unjs/crossws/pull/46), [#45](https://github.com/unjs/crossws/pull/45), [#44](https://github.com/unjs/crossws/pull/44), [a96dca3](https://github.com/unjs/crossws/commit/a96dca3), [898ab49](https://github.com/unjs/crossws/commit/898ab49), [2e49cc3](https://github.com/unjs/crossws/commit/2e49cc3)
72+
73+
### 📦 Build
74+
75+
- Remove optional `uWebSockets.js` dependency ([#52](https://github.com/unjs/crossws/pull/52), [b23b76d](https://github.com/unjs/crossws/commit/b23b76d))
76+
- ⚠️ Esm-only build ([#63](https://github.com/unjs/crossws/pull/63))
77+
78+
### ✅ Tests
79+
80+
- Add adapter tests ([#56](https://github.com/unjs/crossws/pull/56))
81+
- **cloudflare:** Use random port for wrangler inspector ([a46265c](https://github.com/unjs/crossws/commit/a46265c))
82+
- Run tests with web standard `WebSocket` and `EventSource` ([#67](https://github.com/unjs/crossws/pull/67))
83+
84+
### ❤️ Contributors
85+
86+
- Pooya Parsa ([@pi0](http://github.com/pi0))
87+
- Eduardo San Martin Morote ([@posva](http://github.com/posva))
88+
- Alex ([@alexzhang1030](http://github.com/alexzhang1030))
89+
- 39sho ([@39sho](http://github.com/39sho))
90+
- @beer ([@iiio2](http://github.com/iiio2))
91+
- Sébastien Chopin ([@atinux](http://github.com/atinux))
92+
- Pierre Golfier <[email protected]>
393

494
## v0.2.4
595

@@ -81,7 +171,7 @@
81171

82172
### 💅 Refactors
83173

84-
- ⚠️ Improve types and api ([2ebacd3](https://github.com/unjs/crossws/commit/2ebacd3))
174+
- ⚠️ Improve types and api ([2ebacd3](https://github.com/unjs/crossws/commit/2ebacd3))
85175

86176
### 🏡 Chore
87177

@@ -90,7 +180,7 @@
90180

91181
#### ⚠️ Breaking Changes
92182

93-
- ⚠️ Improve types and api ([2ebacd3](https://github.com/unjs/crossws/commit/2ebacd3))
183+
- ⚠️ Improve types and api ([2ebacd3](https://github.com/unjs/crossws/commit/2ebacd3))
94184

95185
### ❤️ Contributors
96186

@@ -169,7 +259,6 @@
169259

170260
## v0.0.1
171261

172-
173262
### 🏡 Chore
174263

175264
- Update readme ([af705a6](https://github.com/unjs/crossws/commit/af705a6))
@@ -178,4 +267,3 @@
178267
### ❤️ Contributors
179268

180269
- Pooya Parsa ([@pi0](http://github.com/pi0))
181-

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "crossws",
3-
"version": "0.2.4",
3+
"version": "0.3.0",
44
"description": "Cross-platform WebSocket Servers for Node.js, Deno, Bun and Cloudflare Workers",
55
"repository": "unjs/crossws",
66
"license": "MIT",

0 commit comments

Comments
 (0)