Compare commits

..

3 Commits

Author SHA1 Message Date
Anselm
5c4ca9103c Release 2024-08-15 13:36:33 +01:00
Anselm
b4aad92907 Option to not expect pings 2024-08-15 13:36:08 +01:00
Anselm
56d1e095a1 Release 2024-08-15 13:02:39 +01:00
29 changed files with 221 additions and 24 deletions

View File

@@ -1,5 +1,20 @@
# jazz-example-chat # jazz-example-chat
## 0.0.74
### Patch Changes
- jazz-react@0.7.27
## 0.0.73
### Patch Changes
- Updated dependencies
- cojson@0.7.26
- jazz-react@0.7.26
- jazz-tools@0.7.26
## 0.0.72 ## 0.0.72
### Patch Changes ### Patch Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "jazz-example-chat", "name": "jazz-example-chat",
"private": true, "private": true,
"version": "0.0.72", "version": "0.0.74",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",

View File

@@ -1,5 +1,20 @@
# jazz-example-chat # jazz-example-chat
## 0.0.53
### Patch Changes
- Updated dependencies
- cojson-transport-ws@0.7.27
## 0.0.52
### Patch Changes
- Updated dependencies
- cojson@0.7.26
- cojson-transport-ws@0.7.26
## 0.0.51 ## 0.0.51
### Patch Changes ### Patch Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "jazz-inspector", "name": "jazz-inspector",
"private": true, "private": true,
"version": "0.0.51", "version": "0.0.53",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",

View File

@@ -1,5 +1,21 @@
# jazz-example-pets # jazz-example-pets
## 0.0.92
### Patch Changes
- jazz-browser-media-images@0.7.27
- jazz-react@0.7.27
## 0.0.91
### Patch Changes
- Updated dependencies
- jazz-react@0.7.26
- jazz-tools@0.7.26
- jazz-browser-media-images@0.7.26
## 0.0.90 ## 0.0.90
### Patch Changes ### Patch Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "jazz-example-pets", "name": "jazz-example-pets",
"private": true, "private": true,
"version": "0.0.90", "version": "0.0.92",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",

View File

@@ -1,5 +1,19 @@
# jazz-example-todo # jazz-example-todo
## 0.0.91
### Patch Changes
- jazz-react@0.7.27
## 0.0.90
### Patch Changes
- Updated dependencies
- jazz-react@0.7.26
- jazz-tools@0.7.26
## 0.0.89 ## 0.0.89
### Patch Changes ### Patch Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "jazz-example-todo", "name": "jazz-example-todo",
"private": true, "private": true,
"version": "0.0.89", "version": "0.0.91",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",

View File

@@ -1,5 +1,13 @@
# cojson-storage-indexeddb # cojson-storage-indexeddb
## 0.7.26
### Patch Changes
- Remove Effect from jazz/cojson internals
- Updated dependencies
- cojson@0.7.26
## 0.7.23 ## 0.7.23
### Patch Changes ### Patch Changes

View File

@@ -1,6 +1,6 @@
{ {
"name": "cojson-storage-indexeddb", "name": "cojson-storage-indexeddb",
"version": "0.7.23", "version": "0.7.26",
"main": "dist/index.js", "main": "dist/index.js",
"type": "module", "type": "module",
"types": "src/index.ts", "types": "src/index.ts",

View File

@@ -1,5 +1,13 @@
# cojson-storage-sqlite # cojson-storage-sqlite
## 0.7.26
### Patch Changes
- Remove Effect from jazz/cojson internals
- Updated dependencies
- cojson@0.7.26
## 0.7.23 ## 0.7.23
### Patch Changes ### Patch Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "cojson-storage-sqlite", "name": "cojson-storage-sqlite",
"type": "module", "type": "module",
"version": "0.7.23", "version": "0.7.26",
"main": "dist/index.js", "main": "dist/index.js",
"types": "src/index.ts", "types": "src/index.ts",
"license": "MIT", "license": "MIT",

View File

@@ -1,5 +1,19 @@
# cojson-transport-nodejs-ws # cojson-transport-nodejs-ws
## 0.7.27
### Patch Changes
- Option to not expect pings
## 0.7.26
### Patch Changes
- Remove Effect from jazz/cojson internals
- Updated dependencies
- cojson@0.7.26
## 0.7.23 ## 0.7.23
### Patch Changes ### Patch Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "cojson-transport-ws", "name": "cojson-transport-ws",
"type": "module", "type": "module",
"version": "0.7.23", "version": "0.7.27",
"main": "dist/index.js", "main": "dist/index.js",
"types": "src/index.ts", "types": "src/index.ts",
"license": "MIT", "license": "MIT",

View File

@@ -1,4 +1,10 @@
import { DisconnectedError, Peer, PingTimeoutError, SyncMessage, cojsonInternals } from "cojson"; import {
DisconnectedError,
Peer,
PingTimeoutError,
SyncMessage,
cojsonInternals,
} from "cojson";
interface WebsocketEvents { interface WebsocketEvents {
close: { code: number; reason: string }; close: { code: number; reason: string };
@@ -37,10 +43,12 @@ export function createWebSocketPeer({
id, id,
websocket, websocket,
role, role,
expectPings = true,
}: { }: {
id: string; id: string;
websocket: AnyWebSocket; websocket: AnyWebSocket;
role: Peer["role"]; role: Peer["role"];
expectPings?: boolean;
}): Peer { }): Peer {
const incoming = new cojsonInternals.Channel< const incoming = new cojsonInternals.Channel<
SyncMessage | DisconnectedError | PingTimeoutError SyncMessage | DisconnectedError | PingTimeoutError
@@ -74,13 +82,15 @@ export function createWebSocketPeer({
console.error("Error while pushing incoming msg", e), console.error("Error while pushing incoming msg", e),
); );
} }
pingTimeout = setTimeout(() => { if (expectPings) {
incoming pingTimeout = setTimeout(() => {
.push("PingTimeout") incoming
.catch((e) => .push("PingTimeout")
console.error("Error while pushing ping timeout", e), .catch((e) =>
); console.error("Error while pushing ping timeout", e),
}, 10_000); );
}, 10_000);
}
}); });
const websocketOpen = new Promise<void>((resolve) => { const websocketOpen = new Promise<void>((resolve) => {
@@ -93,13 +103,15 @@ export function createWebSocketPeer({
outgoing: { outgoing: {
async push(msg) { async push(msg) {
await websocketOpen; await websocketOpen;
websocket.send(JSON.stringify(msg)); if (websocket.readyState === 1) {
websocket.send(JSON.stringify(msg));
}
}, },
close() { close() {
if (websocket.readyState === 1) { if (websocket.readyState === 1) {
websocket.close(); websocket.close();
} }
} },
}, },
role, role,
}; };

View File

@@ -1,5 +1,11 @@
# cojson # cojson
## 0.7.26
### Patch Changes
- Remove Effect from jazz/cojson internals
## 0.7.23 ## 0.7.23
### Patch Changes ### Patch Changes

View File

@@ -5,7 +5,7 @@
"types": "src/index.ts", "types": "src/index.ts",
"type": "module", "type": "module",
"license": "MIT", "license": "MIT",
"version": "0.7.23", "version": "0.7.26",
"devDependencies": { "devDependencies": {
"@types/jest": "^29.5.3", "@types/jest": "^29.5.3",
"@typescript-eslint/eslint-plugin": "^6.2.1", "@typescript-eslint/eslint-plugin": "^6.2.1",

View File

@@ -1,5 +1,19 @@
# jazz-browser-media-images # jazz-browser-media-images
## 0.7.27
### Patch Changes
- jazz-browser@0.7.27
## 0.7.26
### Patch Changes
- Updated dependencies
- jazz-browser@0.7.26
- jazz-tools@0.7.26
## 0.7.25 ## 0.7.25
### Patch Changes ### Patch Changes

View File

@@ -1,6 +1,6 @@
{ {
"name": "jazz-browser-media-images", "name": "jazz-browser-media-images",
"version": "0.7.25", "version": "0.7.27",
"type": "module", "type": "module",
"main": "dist/index.js", "main": "dist/index.js",
"types": "src/index.ts", "types": "src/index.ts",

View File

@@ -1,5 +1,23 @@
# jazz-browser # jazz-browser
## 0.7.27
### Patch Changes
- Updated dependencies
- cojson-transport-ws@0.7.27
## 0.7.26
### Patch Changes
- Remove Effect from jazz/cojson internals
- Updated dependencies
- cojson@0.7.26
- cojson-storage-indexeddb@0.7.26
- cojson-transport-ws@0.7.26
- jazz-tools@0.7.26
## 0.7.25 ## 0.7.25
### Patch Changes ### Patch Changes

View File

@@ -1,6 +1,6 @@
{ {
"name": "jazz-browser", "name": "jazz-browser",
"version": "0.7.25", "version": "0.7.27",
"type": "module", "type": "module",
"main": "dist/index.js", "main": "dist/index.js",
"types": "src/index.ts", "types": "src/index.ts",

View File

@@ -1,5 +1,22 @@
# jazz-autosub # jazz-autosub
## 0.7.27
### Patch Changes
- Updated dependencies
- cojson-transport-ws@0.7.27
## 0.7.26
### Patch Changes
- Remove Effect from jazz/cojson internals
- Updated dependencies
- cojson@0.7.26
- cojson-transport-ws@0.7.26
- jazz-tools@0.7.26
## 0.7.25 ## 0.7.25
### Patch Changes ### Patch Changes

View File

@@ -5,7 +5,7 @@
"types": "src/index.ts", "types": "src/index.ts",
"type": "module", "type": "module",
"license": "MIT", "license": "MIT",
"version": "0.7.25", "version": "0.7.27",
"dependencies": { "dependencies": {
"cojson": "workspace:*", "cojson": "workspace:*",
"cojson-transport-ws": "workspace:*", "cojson-transport-ws": "workspace:*",

View File

@@ -1,5 +1,21 @@
# jazz-react # jazz-react
## 0.7.27
### Patch Changes
- jazz-browser@0.7.27
## 0.7.26
### Patch Changes
- Remove Effect from jazz/cojson internals
- Updated dependencies
- cojson@0.7.26
- jazz-browser@0.7.26
- jazz-tools@0.7.26
## 0.7.25 ## 0.7.25
### Patch Changes ### Patch Changes

View File

@@ -1,6 +1,6 @@
{ {
"name": "jazz-react", "name": "jazz-react",
"version": "0.7.25", "version": "0.7.27",
"type": "module", "type": "module",
"main": "dist/index.js", "main": "dist/index.js",
"types": "src/index.ts", "types": "src/index.ts",

View File

@@ -1,5 +1,21 @@
# jazz-autosub # jazz-autosub
## 0.7.27
### Patch Changes
- Updated dependencies
- cojson-transport-ws@0.7.27
## 0.7.26
### Patch Changes
- Updated dependencies
- cojson@0.7.26
- cojson-transport-ws@0.7.26
- jazz-tools@0.7.26
## 0.7.25 ## 0.7.25
### Patch Changes ### Patch Changes

View File

@@ -3,7 +3,7 @@
"bin": "./dist/index.js", "bin": "./dist/index.js",
"type": "module", "type": "module",
"license": "MIT", "license": "MIT",
"version": "0.7.25", "version": "0.7.27",
"scripts": { "scripts": {
"lint": "eslint . --ext ts,tsx", "lint": "eslint . --ext ts,tsx",
"format": "prettier --write './src/**/*.{ts,tsx}'", "format": "prettier --write './src/**/*.{ts,tsx}'",

View File

@@ -1,5 +1,13 @@
# jazz-autosub # jazz-autosub
## 0.7.26
### Patch Changes
- Remove Effect from jazz/cojson internals
- Updated dependencies
- cojson@0.7.26
## 0.7.25 ## 0.7.25
### Patch Changes ### Patch Changes

View File

@@ -5,7 +5,7 @@
"types": "./src/index.ts", "types": "./src/index.ts",
"type": "module", "type": "module",
"license": "MIT", "license": "MIT",
"version": "0.7.25", "version": "0.7.26",
"dependencies": { "dependencies": {
"cojson": "workspace:*", "cojson": "workspace:*",
"fast-check": "^3.17.2" "fast-check": "^3.17.2"