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

@@ -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). |