@basementuniverse/jsonpad-realtime-sdk 1.4.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +91 -0
- package/README.md +2 -0
- package/build/jsonpad-realtime-sdk.d.ts +2 -1
- package/package.json +1 -1
- package/src/events/realtime-error-event.ts +2 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@basementuniverse/jsonpad-realtime-sdk`.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this package adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
Dates are npm publish dates. Entries up to and including 1.2.1 were backfilled
|
|
9
|
+
on 2026-09-14 from git history and are deliberately brief.
|
|
10
|
+
|
|
11
|
+
## [1.5.0] - 2026-09-13
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- `RealtimeErrorEvent` now carries the server's `code` and `errorName` for
|
|
16
|
+
failures that are not connection refusals — for example `16006`, raised when
|
|
17
|
+
an alias index is still being built.
|
|
18
|
+
|
|
19
|
+
## [1.4.0] - 2026-09-13
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
|
|
23
|
+
- `tags` on the `List` and `Item` event payload types.
|
|
24
|
+
|
|
25
|
+
## [1.3.1] - 2026-09-12
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
|
|
29
|
+
- Documented the interaction with guard indexes: realtime clients authenticate
|
|
30
|
+
with an API token and never with an identity, so any value covered by a guard
|
|
31
|
+
index has already been removed from `data` before the event is published.
|
|
32
|
+
|
|
33
|
+
## [1.3.0] - 2026-09-12
|
|
34
|
+
|
|
35
|
+
The platform now caps concurrent realtime connections per account according to
|
|
36
|
+
plan, and refuses connections over that cap.
|
|
37
|
+
|
|
38
|
+
### Added
|
|
39
|
+
|
|
40
|
+
- `RealtimeErrorEvent`, dispatched as an `'error'` event, carrying the server's
|
|
41
|
+
error `code` and `errorName`, the plan's connection limit (`max`), the delay
|
|
42
|
+
the server asked for (`retryAfter`) and the delay this client will actually
|
|
43
|
+
wait (`retryIn`). The event's `detail` is still the error message, so existing
|
|
44
|
+
`'error'` listeners keep working.
|
|
45
|
+
- Automatic retry when a connection is refused for exceeding the connection
|
|
46
|
+
limit, backing off exponentially from the server's requested delay with
|
|
47
|
+
jitter. A connection lost to a network problem holds its server-side slot for
|
|
48
|
+
up to 45 seconds, so an immediate reconnect can be refused for a limit the
|
|
49
|
+
account is not really over.
|
|
50
|
+
- A `retry` option to turn that behaviour off. Defaults to `true`.
|
|
51
|
+
|
|
52
|
+
### Fixed
|
|
53
|
+
|
|
54
|
+
- A socket that was still connecting, or reconnecting in the background, was
|
|
55
|
+
not closed by `close()` or by a subsequent `listen()`, and went on holding a
|
|
56
|
+
connection slot on the server.
|
|
57
|
+
|
|
58
|
+
## [1.2.1] - 2024-12-17
|
|
59
|
+
|
|
60
|
+
### Changed
|
|
61
|
+
|
|
62
|
+
- Updated README.
|
|
63
|
+
|
|
64
|
+
## [1.2.0] - 2024-12-14
|
|
65
|
+
|
|
66
|
+
### Changed
|
|
67
|
+
|
|
68
|
+
- Model data on item events is parsed rather than passed through as a string.
|
|
69
|
+
|
|
70
|
+
## [1.1.0] - 2024-11-17
|
|
71
|
+
|
|
72
|
+
### Added
|
|
73
|
+
|
|
74
|
+
- Additional event and payload types.
|
|
75
|
+
|
|
76
|
+
### Fixed
|
|
77
|
+
|
|
78
|
+
- Build output.
|
|
79
|
+
|
|
80
|
+
## [1.0.0] - 2024-11-17
|
|
81
|
+
|
|
82
|
+
Initial release, alongside the JSONPad launch.
|
|
83
|
+
|
|
84
|
+
### Added
|
|
85
|
+
|
|
86
|
+
- `JSONPadRealtime`, a socket.io client for the JSONPad realtime server, for
|
|
87
|
+
both Node and the browser.
|
|
88
|
+
- `listen()` with event type, list and item filtering, `close()`, and a
|
|
89
|
+
`connected` getter.
|
|
90
|
+
- `connected`, `disconnected`, `error` and per-event-type events dispatched
|
|
91
|
+
through `EventTarget`.
|
package/README.md
CHANGED
|
@@ -90,6 +90,8 @@ A connection that drops without closing cleanly keeps its slot on the server unt
|
|
|
90
90
|
const jsonpadRealtime = new JSONPadRealtime('your-api-token', { retry: false });
|
|
91
91
|
```
|
|
92
92
|
|
|
93
|
+
The same happens if you subscribe to items by alias while one of your alias indexes is still being built: the connection is refused with `INDEX_BUILDING` (code 16006), and retried once the server's suggested delay has passed. Subscribing by item id always works.
|
|
94
|
+
|
|
93
95
|
## `listen()` method
|
|
94
96
|
|
|
95
97
|
The `listen()` method takes an array of event types to listen for. You can pass in any of the following event types:
|
|
@@ -110,7 +110,8 @@ declare class ListEvent extends CustomEvent<any> {
|
|
|
110
110
|
*/
|
|
111
111
|
declare class RealtimeErrorEvent extends CustomEvent<string> {
|
|
112
112
|
/**
|
|
113
|
-
* The jsonpad error code, e.g. 10015
|
|
113
|
+
* The jsonpad error code, e.g. 10015 (too many connections) or 16006 (an
|
|
114
|
+
* alias index is still being built), or null if the error didn't come from
|
|
114
115
|
* the server
|
|
115
116
|
*/
|
|
116
117
|
readonly code: number | null;
|
package/package.json
CHANGED
|
@@ -9,7 +9,8 @@ import { RealtimeErrorData } from '../types';
|
|
|
9
9
|
*/
|
|
10
10
|
export class RealtimeErrorEvent extends CustomEvent<string> {
|
|
11
11
|
/**
|
|
12
|
-
* The jsonpad error code, e.g. 10015
|
|
12
|
+
* The jsonpad error code, e.g. 10015 (too many connections) or 16006 (an
|
|
13
|
+
* alias index is still being built), or null if the error didn't come from
|
|
13
14
|
* the server
|
|
14
15
|
*/
|
|
15
16
|
public readonly code: number | null;
|