Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a9972ad0ce | |||
| b3c77eb675 |
@@ -1,5 +1,11 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2025-12-03 - 1.1.1 - fix(adapters)
|
||||||
|
Attach WebSocket peer to typedRouter request localData and add ws dependency
|
||||||
|
|
||||||
|
- When routing incoming WebSocket messages through TypedRouter (node/deno/bun), the connection peer is now attached to requestObj.localData so typed handlers can access the active connection.
|
||||||
|
- Add runtime dependency on "ws" to enable WebSocket support in the Node adapter (used by dynamic import in the adapter).
|
||||||
|
|
||||||
## 2025-12-02 - 1.1.0 - feat(websocket)
|
## 2025-12-02 - 1.1.0 - feat(websocket)
|
||||||
Add TypedRouter WebSocket integration, connection registry, peer tagging and broadcast APIs
|
Add TypedRouter WebSocket integration, connection registry, peer tagging and broadcast APIs
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@push.rocks/smartserve",
|
"name": "@push.rocks/smartserve",
|
||||||
"version": "1.1.0",
|
"version": "1.1.1",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "a cross platform server module for Node, Deno and Bun",
|
"description": "a cross platform server module for Node, Deno and Bun",
|
||||||
"exports": {
|
"exports": {
|
||||||
@@ -28,7 +28,8 @@
|
|||||||
"@push.rocks/lik": "^6.2.2",
|
"@push.rocks/lik": "^6.2.2",
|
||||||
"@push.rocks/smartenv": "^6.0.0",
|
"@push.rocks/smartenv": "^6.0.0",
|
||||||
"@push.rocks/smartlog": "^3.1.10",
|
"@push.rocks/smartlog": "^3.1.10",
|
||||||
"@push.rocks/smartpath": "^6.0.0"
|
"@push.rocks/smartpath": "^6.0.0",
|
||||||
|
"ws": "^8.18.0"
|
||||||
},
|
},
|
||||||
"packageManager": "pnpm@10.18.1+sha512.77a884a165cbba2d8d1c19e3b4880eee6d2fcabd0d879121e282196b80042351d5eb3ca0935fa599da1dc51265cc68816ad2bddd2a2de5ea9fdf92adbec7cd34",
|
"packageManager": "pnpm@10.18.1+sha512.77a884a165cbba2d8d1c19e3b4880eee6d2fcabd0d879121e282196b80042351d5eb3ca0935fa599da1dc51265cc68816ad2bddd2a2de5ea9fdf92adbec7cd34",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
3
pnpm-lock.yaml
generated
3
pnpm-lock.yaml
generated
@@ -23,6 +23,9 @@ importers:
|
|||||||
'@push.rocks/smartpath':
|
'@push.rocks/smartpath':
|
||||||
specifier: ^6.0.0
|
specifier: ^6.0.0
|
||||||
version: 6.0.0
|
version: 6.0.0
|
||||||
|
ws:
|
||||||
|
specifier: ^8.18.0
|
||||||
|
version: 8.18.3
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@git.zone/tsbuild':
|
'@git.zone/tsbuild':
|
||||||
specifier: ^3.1.2
|
specifier: ^3.1.2
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@push.rocks/smartserve',
|
name: '@push.rocks/smartserve',
|
||||||
version: '1.1.0',
|
version: '1.1.1',
|
||||||
description: 'a cross platform server module for Node, Deno and Bun'
|
description: 'a cross platform server module for Node, Deno and Bun'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -137,6 +137,8 @@ export class BunAdapter extends BaseAdapter {
|
|||||||
if (typedRouter && typeof message === 'string') {
|
if (typedRouter && typeof message === 'string') {
|
||||||
try {
|
try {
|
||||||
const requestObj = JSON.parse(message);
|
const requestObj = JSON.parse(message);
|
||||||
|
// Attach peer to localData so TypedHandlers can access the connection
|
||||||
|
requestObj.localData = { ...requestObj.localData, peer };
|
||||||
const response = await typedRouter.routeAndAddResponse(requestObj);
|
const response = await typedRouter.routeAndAddResponse(requestObj);
|
||||||
if (response) {
|
if (response) {
|
||||||
peer.send(JSON.stringify(response));
|
peer.send(JSON.stringify(response));
|
||||||
|
|||||||
@@ -115,6 +115,8 @@ export class DenoAdapter extends BaseAdapter {
|
|||||||
if (typedRouter && typeof event.data === 'string') {
|
if (typedRouter && typeof event.data === 'string') {
|
||||||
try {
|
try {
|
||||||
const requestObj = JSON.parse(event.data);
|
const requestObj = JSON.parse(event.data);
|
||||||
|
// Attach peer to localData so TypedHandlers can access the connection
|
||||||
|
requestObj.localData = { ...requestObj.localData, peer };
|
||||||
const response = await typedRouter.routeAndAddResponse(requestObj);
|
const response = await typedRouter.routeAndAddResponse(requestObj);
|
||||||
if (response) {
|
if (response) {
|
||||||
peer.send(JSON.stringify(response));
|
peer.send(JSON.stringify(response));
|
||||||
|
|||||||
@@ -283,6 +283,8 @@ export class NodeAdapter extends BaseAdapter {
|
|||||||
try {
|
try {
|
||||||
const messageText = typeof data === 'string' ? data : data.toString('utf8');
|
const messageText = typeof data === 'string' ? data : data.toString('utf8');
|
||||||
const requestObj = JSON.parse(messageText);
|
const requestObj = JSON.parse(messageText);
|
||||||
|
// Attach peer to localData so TypedHandlers can access the connection
|
||||||
|
requestObj.localData = { ...requestObj.localData, peer };
|
||||||
const response = await typedRouter.routeAndAddResponse(requestObj);
|
const response = await typedRouter.routeAndAddResponse(requestObj);
|
||||||
if (response) {
|
if (response) {
|
||||||
peer.send(JSON.stringify(response));
|
peer.send(JSON.stringify(response));
|
||||||
|
|||||||
Reference in New Issue
Block a user