15 KiB
Changelog
v0.3.3
🚀 Enhancements
- Allow throwing error with
.responseprop inupgrade(#113)
❤️ Contributors
- Luke Hagar (@LukeHagar)
v0.3.2
🚀 Enhancements
- Support throwing responses in
upgradehook (#91) - peer: Support
context(#110) - Shared context between
upgradehook andpeer(#111)
🩹 Fixes
- types:
peer.requestalways has.headersif defined (e915f8d) - types: Mark
peer.requestas always defined (8fbb59b)
📖 Documentation
🏡 Chore
- release: V0.3.1 (c6d888f)
- example: Handle binary/blob messages (38c6baa)
- Update eslint config (d3ab5f8)
- Update deps (590a4a7)
- Update deno typos (095c538)
- Update deps (bef0f4f)
- examples: Fix typo (#107)
- Remote unused type (e3c2cf5)
- Update build config (3f5a5dc)
- Fix upgrade hook type (ee7b282)
❤️ Contributors
- Pooya Parsa (@pi0)
- Luke Hagar (@LukeHagar)
- 39sho (@39sho)
- Sandro Circi (@sandros94)
- Jamaluddin Rumi jamal.rumi@icloud.com
v0.3.1
🩹 Fixes
- types:
AdapterOptionstype (#80)
🏡 Chore
❤️ Contributors
v0.3.0
🌟 What is new?
Better stability
Crossws 0.3.x includes an overhaul of refactors, stability improvements, and new features. A new codebase and testing matrix had been implemented (#55) to make sure all supported adapters and runtimes work as expected and are consistent with each other.
Refined Peer API
The peer object allows easy interaction with connected WebSocket clients from server route hooks (peer docs).
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.
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 interface using peer.websocket.
Note
Today many of the server runtimes don't provide a spec-compliant
WebSocketAPI. Crossws uses an internal proxy to polyfill consistent access toextensions,protocol, andreadyState. See compatibility table for more details.
Refined Message API
On message hook, you receive a message object containing data from the client (message docs).
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
Authentication via upgrade hook
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 in case you need to abort the upgrade.
Pubsub with Deno and Cloudflare Durable Objects
One of the common use cases of WebSockets is pubsub. This release adds pub-sub support to Deno provider and also you can globally broadcast messages using ws.publish for advanced use cases.
Normally with cloudflare workers, it is not possible to connect multiple peers with each other. Cloudflare Durable Objects (available on paid plans) allows building collaborative editing tools, interactive chat, multiplayer games, and applications that need coordination among multiple clients.
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)
Changelog
🚀 Enhancements
- ⚠️ Overhaul internal implementation (#55)
- ⚠️ Overhaul peer and message interface (#70)
- node, uws: Automatically detect binary message type (#53)
- peer: Add
peer.close()andpeer.terminate()support (#36) - Cloudflare durable objects support (#54) (docs)
- deno: Support pub/sub (#58)
- Universal access to all peers (#60)
- Global publish using
ws.publish(#61) - Experimental SSE-based adapter to support websocket in limited runtimes (#62, #66, #68) (docs
- peer: Use secure lazy random UUID v4 (#64)
🩹 Fixes
- Should not serailize binary messages (#39)
- cloudflare-durable: Restore peer url and id after hibernation (#71)
💅 Refactors
- ⚠️ Move
peer.ctxtopeer._internal(#59) - ⚠️ Remove adapter hooks (#72)
- Rename internal crossws to hooks (bb4c917)
- Better internal organization (2744f21)
📖 Documentation
#22, 76fc105, 7dacb00, #46, #45, #44, a96dca3, 898ab49, 2e49cc3
📦 Build
✅ Tests
- Add adapter tests (#56)
- cloudflare: Use random port for wrangler inspector (a46265c)
- Run tests with web standard
WebSocketandEventSource(#67)
❤️ Contributors
- Pooya Parsa (@pi0)
- Eduardo San Martin Morote (@posva)
- Alex (@alexzhang1030)
- 39sho (@39sho)
- @beer (@iiio2)
- Sébastien Chopin (@atinux)
- Pierre Golfier pro@pedraal.fr
v0.2.4
🚀 Enhancements
💅 Refactors
- Improve peer inspect message (9f7e1f0)
📖 Documentation
- Update content (6d78e12)
🏡 Chore
- Use seperate playground index (889b37b)
- Update lockfile (c119028)
- Update docs (54e0dca)
- Update playground (a6879bd)
- Update example (0ce11c5)
- Update playground (cbeb472)
❤️ Contributors
- Pooya Parsa (@pi0)
v0.2.3
🩹 Fixes
- node: Respect
x-forwardedfor client id (3f8bd0c)
❤️ Contributors
- Pooya Parsa (@pi0)
v0.2.2
🩹 Fixes
- deno: Pass info (2c63b37)
🏡 Chore
- example: Handle secure origins (7f8639f)
❤️ Contributors
- Pooya Parsa (@pi0)
v0.2.1
🩹 Fixes
$callHookshould check hook existence (40082ba)
📖 Documentation
- Update usage to 0.2x (db99a91)
❤️ Contributors
- Pooya Parsa (@pi0)
v0.2.0
💅 Refactors
- ⚠️ Improve types and api (2ebacd3)
🏡 Chore
⚠️ Breaking Changes
- ⚠️ Improve types and api (2ebacd3)
❤️ Contributors
- Pooya Parsa (@pi0)
v0.1.3
🏡 Chore
- Add build script to release (6681afa)
❤️ Contributors
- Pooya Parsa (@pi0)
v0.1.2
🚀 Enhancements
- Support `uWebSockets.js (b1de991)
- Allow access to peer url and headers (b67bef0)
- Dynamic resolver (cb6721c)
- Support upgrade hook to set headers (91edb54)
- Pub/sub support for
bunanduws(a486f45)
💅 Refactors
📖 Documentation
🏡 Chore
- Update examples (a347e80)
- Initial docs (2f3e983)
- Add h3 example (894792a)
- Fix docs workspace root (a607b89)
- Update docs (5f72d42)
- Update docs (52c0e4f)
- Specify
uWebSockets.jspeer dep (1ef0585)
❤️ Contributors
- Pooya Parsa (@pi0)
v0.1.1
💅 Refactors
- Import bun types from @types/bun (ba40b53)
📦 Build
- Expose default export for compatibility types (9934fb5)
🏡 Chore
❤️ Contributors
- Pooya Parsa (@pi0)
v0.0.1
🏡 Chore
❤️ Contributors
- Pooya Parsa (@pi0)