diff --git a/changelog.md b/changelog.md index e6b6270..b5c063b 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,12 @@ # Changelog +## 2025-08-29 - 2.2.1 - fix(tests) +Remove redundant manual topic handlers from tests and rely on server built-in pub/sub + +- Removed manual server.onMessage('__subscribe__') and server.onMessage('__publish__') handlers from test/test.ts +- Tests now rely on the server's built-in publish/subscribe behavior: clients publish directly and subscribers receive messages +- Test code simplified without changing public API or runtime behavior + ## 2025-08-29 - 2.2.0 - feat(ipcclient) Add clientOnly mode to prevent clients from auto-starting servers and improve registration/reconnect behavior @@ -91,4 +98,11 @@ Metadata and configuration updates; repository/org migration. Initial release and a series of patch fixes to core components. - 1.0.1: initial release. -- 1.0.2 → 1.0.7: a sequence of small core fixes and maintenance updates (repeated "fix(core): update" commits). \ No newline at end of file +- 1.0.2 → 1.0.7: a sequence of small core fixes and maintenance updates (repeated "fix(core): update" commits). +## 2025-08-29 - 2.1.4 - feat(transports) +Add client-only mode to prevent unintended server auto-start in Unix/NamedPipe transports; safer probing + +- Add `clientOnly?: boolean` to transport options; when true (or `SMARTIPC_CLIENT_ONLY=1`), a client will fail fast on `ECONNREFUSED`/`ENOENT` instead of auto-starting a server. +- Update `SmartIpc.waitForServer()` to probe with `clientOnly: true` to avoid races during readiness checks. +- Extend tests to cover option and env override; update core test to use unique socket path and auto-cleanup. +- Docs: add README section for client-only mode. diff --git a/test/test.ts b/test/test.ts index 18b8fa4..f012566 100644 --- a/test/test.ts +++ b/test/test.ts @@ -161,17 +161,6 @@ tap.test('should handle pub/sub pattern', async () => { messageReceived.resolve(); }); - // Server handles the subscription - server.onMessage('__subscribe__', async (payload, clientId) => { - expect(payload.topic).toEqual('news'); - }); - - // Server handles publishing - server.onMessage('__publish__', async (payload, clientId) => { - // Broadcast to all subscribers of the topic - await server.broadcast(`topic:${payload.topic}`, payload.payload); - }); - // Client 2 publishes to the topic await client2.publish('news', { headline: 'Breaking news!' }); diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 04b32e9..a70aa50 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@push.rocks/smartipc', - version: '2.2.0', + version: '2.2.1', description: 'A library for node inter process communication, providing an easy-to-use API for IPC.' }