|
| 1 | +# [0.0.8](https://github.com/AmadeusITGroup/microfrontends/compare/0.0.7...0.0.8) (2025-07-01) |
| 2 | + |
| 3 | +Introduces the [new `.listen()` API](https://github.com/AmadeusITGroup/microfrontends/blob/main/packages/core/README.md#listening-for-connections) and adds support for Angular 20. |
| 4 | + |
| 5 | +**New listening API** |
| 6 | + |
| 7 | +Listening happens in the background until you stop it explicitly. This allows you to start listening for handshake from multiple peers at once, using a variety of ways to accept or decline incoming connections. |
| 8 | + |
| 9 | +```ts |
| 10 | +// start listening for specific incoming connections |
| 11 | +const stop = peer.listen(/* filter using ids, objects, or a custom function */); |
| 12 | + |
| 13 | +// stop listening |
| 14 | +stop(); |
| 15 | +``` |
| 16 | + |
| 17 | +### Features |
| 18 | + |
| 19 | +- Introduce the new `.listen()` API ([dc1907c](https://github.com/AmadeusITGroup/microfrontends/commit/dc1907c6eebf513e97c776a605ad14dc916a4541)) |
| 20 | +- Introduce the `Peer.peerConnections` API and harmonize connection messages ([668c8d2](https://github.com/AmadeusITGroup/microfrontends/commit/668c8d29a537baeb8eeee8da5db4c2cbe4d170be)) |
| 21 | +- Expose `'handshake'` message to the user in `serviceMessages` ([55b83a2](https://github.com/AmadeusITGroup/microfrontends/commit/55b83a257d124f8673ea721ca1e81868ffb58a7d)) |
| 22 | + |
| 23 | +### Fixes |
| 24 | + |
| 25 | +- `MessagePeerService` should disconnect and stop listening in `ngOnDestroy`([9feba99 |
| 26 | + ](https://github.com/AmadeusITGroup/microfrontends/commit/9feba9907821a1570c8d80338aaab8d74f1b1d91)) |
| 27 | + |
| 28 | +### BREAKING CHANGES |
| 29 | + |
| 30 | +- new `.listen()` API returns a function that stops listening |
| 31 | + |
| 32 | +```ts |
| 33 | +// BEFORE |
| 34 | +const disconnect = await peer.listen('foo'); // start listening for 'two' |
| 35 | +disconnect(); // disconnect, no way you can stop listening |
| 36 | + |
| 37 | +// AFTER |
| 38 | +const stop = peer.listen('foo'); // start listening |
| 39 | +stop(); // stop listening |
| 40 | +peer.disconnect('foo'); // disconnect from peer 'two' |
| 41 | +``` |
| 42 | + |
| 43 | +- new `.listen()` API changes the way of listening for multiple connections |
| 44 | + |
| 45 | +```ts |
| 46 | +// BEFORE |
| 47 | +peer.listen('foo'); // start listening for 'foo' |
| 48 | +peer.listen('bar'); // start listening for 'bar' <- this will not work as expected before |
| 49 | + |
| 50 | +// AFTER |
| 51 | +// In new version the example above would not work |
| 52 | +// it would stop listening for 'foo' and start listening for 'bar'. |
| 53 | +// Ideally you should call `.listen()` only once. ex: |
| 54 | +peer.listen(['foo', 'bar']); // start listening for connections from both 'foo' and 'bar' |
| 55 | +// or |
| 56 | +peer.listen(); // allow any connection unitl stopped listening |
| 57 | +// or |
| 58 | +peer.listen((message, source, origin) => { |
| 59 | + // accept or decline connection based on the handshake message, source and origin |
| 60 | + return ['foo', 'bar'].includes(message.from); |
| 61 | +}); |
| 62 | +``` |
| 63 | + |
1 | 64 | # [0.0.7](https://github.com/AmadeusITGroup/microfrontends/compare/0.0.6...0.0.7) (2025-04-11) |
2 | 65 |
|
3 | 66 | ### Features |
|
0 commit comments