BREAKING CHANGE(TypedSocket.createServer): Remove SmartExpress attachment support from createServer and upgrade smartsocket to ^3.0.0

This commit is contained in:
2025-12-03 09:34:33 +00:00
parent e2e359c9c7
commit 14966304e3
6 changed files with 35 additions and 27 deletions

View File

@@ -1,5 +1,13 @@
# Changelog
## 2025-12-03 - 4.0.0 - BREAKING CHANGE(TypedSocket.createServer)
Remove SmartExpress attachment support from createServer and upgrade smartsocket to ^3.0.0
- Bump dependency @push.rocks/smartsocket from ^2.1.0 to ^3.0.0.
- Remove optional SmartExpress attachment parameter from TypedSocket.createServer and remove the setExternalServer call — createServer now only accepts a TypedRouter and starts its own Smartsocket server.
- Update README: remove the SmartExpress integration section and adjust the API docs to reflect the new createServer(router) signature.
- Adjust TypeScript implementation to match the simplified createServer signature and behavior.
## 2025-12-02 - 3.1.1 - fix(package)
Include pnpm packageManager metadata in package.json

View File

@@ -29,7 +29,7 @@
"@push.rocks/isohash": "^2.0.1",
"@push.rocks/smartjson": "^5.2.0",
"@push.rocks/smartrx": "^3.0.10",
"@push.rocks/smartsocket": "^2.1.0",
"@push.rocks/smartsocket": "^3.0.0",
"@push.rocks/smartstring": "^4.1.0",
"@push.rocks/smarturl": "^3.1.0"
},

27
pnpm-lock.yaml generated
View File

@@ -24,8 +24,8 @@ importers:
specifier: ^3.0.10
version: 3.0.10
'@push.rocks/smartsocket':
specifier: ^2.1.0
version: 2.1.0
specifier: ^3.0.0
version: 3.0.0
'@push.rocks/smartstring':
specifier: ^4.1.0
version: 4.1.0
@@ -1176,6 +1176,9 @@ packages:
'@push.rocks/smartsocket@2.1.0':
resolution: {integrity: sha512-etOGyfiDFQz/1WJnD3jFL2N7ykujTjiudAz6qZTz82xE5oabKuKX+Cn8SdM9dOwzyWmBUKbUdll8QhovAXjn+g==}
'@push.rocks/smartsocket@3.0.0':
resolution: {integrity: sha512-8pUbOybNBwXF+D9VsuC+3LjD+r9uRzcgcwFRcpic6WGVqW0c5hI8D8YwKDHkL11XJJD7yNRJnsoIc618EVUvuQ==}
'@push.rocks/smartspawn@3.0.3':
resolution: {integrity: sha512-DyrGPV69wwOiJgKkyruk5hS3UEGZ99xFAqBE9O2nM8VXCRLbbty3xt1Ug5Z092ZZmJYaaGMSnMw3ijyZJFCT0Q==}
@@ -5121,10 +5124,8 @@ snapshots:
lit: 3.2.1
transitivePeerDependencies:
- '@nuxt/kit'
- bufferutil
- react
- supports-color
- utf-8-validate
- vue
'@api.global/typedserver@3.0.80':
@@ -7531,6 +7532,24 @@ snapshots:
- utf-8-validate
- vue
'@push.rocks/smartsocket@3.0.0':
dependencies:
'@api.global/typedrequest-interfaces': 3.0.19
'@push.rocks/isohash': 2.0.1
'@push.rocks/isounique': 1.0.5
'@push.rocks/lik': 6.2.2
'@push.rocks/smartdelay': 3.0.5
'@push.rocks/smartenv': 6.0.0
'@push.rocks/smartjson': 5.2.0
'@push.rocks/smartlog': 3.1.10
'@push.rocks/smartpromise': 4.2.3
'@push.rocks/smartrx': 3.0.10
'@push.rocks/smarttime': 4.1.1
ws: 8.18.3
transitivePeerDependencies:
- bufferutil
- utf-8-validate
'@push.rocks/smartspawn@3.0.3':
dependencies:
'@push.rocks/smartpromise': 4.2.3

View File

@@ -13,7 +13,6 @@ For reporting bugs, issues, or security vulnerabilities, please visit [community
- 🔌 **Auto-reconnect** - Client automatically reconnects on connection loss
- 🏷️ **Connection Tagging** - Tag and filter connections for targeted messaging
- 🌐 **Browser Compatible** - Works in both Node.js and browser environments
- 🔗 **SmartExpress Integration** - Optional integration with existing SmartExpress servers
- 🚀 **SmartServe Integration** - Native support for SmartServe's WebSocket handling
## Install
@@ -80,20 +79,6 @@ typedRouter.addTypedHandler<IGreetingRequest>(
const server = await TypedSocket.createServer(typedRouter);
```
#### Integration with SmartExpress
If you have an existing SmartExpress server, you can attach TypedSocket to it:
```typescript
import { TypedSocket } from '@api.global/typedsocket';
import * as smartexpress from '@push.rocks/smartexpress';
const smartExpressServer = new smartexpress.Server({ port: 8080 });
await smartExpressServer.start();
const server = await TypedSocket.createServer(typedRouter, smartExpressServer);
```
#### Integration with SmartServe
For SmartServe-based applications, use `fromSmartServe()` for native integration:
@@ -265,7 +250,7 @@ await server.stop();
| Method | Description |
|--------|-------------|
| `createServer(router, smartExpressServer?)` | Creates a WebSocket server. Optionally attach to an existing SmartExpress server. |
| `createServer(router)` | Creates a WebSocket server (defaults to port 3000). |
| `createClient(router, serverUrl, alias?)` | Creates a WebSocket client that connects to the specified server URL. |
| `fromSmartServe(smartServe, router)` | Creates a TypedSocket bound to an existing SmartServe instance. |
| `useWindowLocationOriginUrl()` | Returns the current window location origin (browser only). |

View File

@@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@api.global/typedsocket',
version: '3.1.1',
version: '4.0.0',
description: 'A library for creating typed WebSocket connections, supporting bi-directional communication with type safety.'
}

View File

@@ -38,16 +38,12 @@ export class TypedSocket {
* note: this will fail in browser environments as server libs are not bundled.
*/
public static async createServer(
typedrouterArg: plugins.typedrequest.TypedRouter,
smartexpressServerArg?: any
typedrouterArg: plugins.typedrequest.TypedRouter
): Promise<TypedSocket> {
const smartsocketServer = new plugins.smartsocket.Smartsocket({
alias: 'typedsocketServer',
port: 3000,
});
if (smartexpressServerArg) {
smartsocketServer.setExternalServer('smartexpress', smartexpressServerArg);
}
smartsocketServer.socketFunctions.add(
new plugins.smartsocket.SocketFunction({