@sockethub/client 5.0.0-beta.0 → 5.0.0-beta.2
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/README.md +14 -1
- package/dist/replay-store.d.ts +9 -0
- package/dist/sockethub-client.browser.js +250 -34
- package/dist/sockethub-client.d.ts +17 -2
- package/dist/sockethub-client.js +250 -34
- package/dist/sockethub-client.min.js +17 -17
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -150,7 +150,8 @@ See the [Client Guide](../../docs/client-guide.md) for detailed usage and exampl
|
|
|
150
150
|
- **`sc.validateActivity(activity)`** - Validate against registered schemas
|
|
151
151
|
- **`sc.socket.emit(event, data, callback)`** - Send messages (queued until ready)
|
|
152
152
|
- **`sc.socket.on(event, handler)`** - Listen for messages
|
|
153
|
-
- **`sc.clearCredentials()`** - Clear stored credentials
|
|
153
|
+
- **`sc.clearCredentials()`** - Clear stored and queued credentials. Pass
|
|
154
|
+
`{ platform, actorId }` to clear one account and its connection/join replay.
|
|
154
155
|
|
|
155
156
|
Send a full `actor` object on each `credentials` and `message` event.
|
|
156
157
|
|
|
@@ -175,6 +176,10 @@ sc.socket.emit("message", {
|
|
|
175
176
|
});
|
|
176
177
|
```
|
|
177
178
|
|
|
179
|
+
Before a job is queued, a failure result contains `error` and omits the
|
|
180
|
+
activity you submitted. The shape is described in the
|
|
181
|
+
[client guide](../../docs/client-guide.md#message-limits).
|
|
182
|
+
|
|
178
183
|
Also listen for ongoing platform events:
|
|
179
184
|
|
|
180
185
|
```javascript
|
|
@@ -223,6 +228,14 @@ change, whether you requested it and the server acknowledged it or the server re
|
|
|
223
228
|
stored entries move to the new actor so a reconnect replays the identity the connection currently
|
|
224
229
|
holds.
|
|
225
230
|
|
|
231
|
+
Only `actor.id` and `actor.name` move. The credential object stays as the
|
|
232
|
+
application submitted it, including `nick`, `password`, and `token`. The
|
|
233
|
+
server selects the live connection by a fingerprint of that object, so
|
|
234
|
+
rewriting `nick` on reconnect opens a different session. An acknowledgement
|
|
235
|
+
or incoming update that contains `error` does not move the stored entries;
|
|
236
|
+
keep sending as the previous actor. A timeout or a dropped socket, delivered
|
|
237
|
+
as an `Error`, does not move them either.
|
|
238
|
+
|
|
226
239
|
#### Storage Location
|
|
227
240
|
|
|
228
241
|
**All state is stored ONLY in JavaScript memory.** Nothing is persisted to:
|
package/dist/replay-store.d.ts
CHANGED
|
@@ -18,6 +18,11 @@ export declare function hasActorId(obj: ActivityStream): obj is ActivityStream;
|
|
|
18
18
|
* and `target` the new one.
|
|
19
19
|
*/
|
|
20
20
|
export declare function isActorRename(activity: ActivityStream): boolean;
|
|
21
|
+
/** Match normalized or queued account credentials without requiring initialization. */
|
|
22
|
+
export declare function matchesAccount(content: unknown, scope: {
|
|
23
|
+
platform: string;
|
|
24
|
+
actorId: string;
|
|
25
|
+
}): boolean;
|
|
21
26
|
/**
|
|
22
27
|
* In-memory storage for client state that should be replayed on reconnection.
|
|
23
28
|
*
|
|
@@ -26,6 +31,10 @@ export declare function isActorRename(activity: ActivityStream): boolean;
|
|
|
26
31
|
*/
|
|
27
32
|
export declare class ReplayStore {
|
|
28
33
|
readonly events: EventMapping;
|
|
34
|
+
clearCredentials(scope?: {
|
|
35
|
+
platform: string;
|
|
36
|
+
actorId: string;
|
|
37
|
+
}): void;
|
|
29
38
|
recordCredentials(content: ActivityStream): void;
|
|
30
39
|
/**
|
|
31
40
|
* Stores connect/join commands and drops them again on
|