@hocuspocus/extension-redis 2.0.0-alpha.0 → 2.0.0-alpha.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.
@@ -87,6 +87,7 @@ export declare class HocuspocusProvider extends EventEmitter {
87
87
  set synced(state: boolean);
88
88
  receiveStateless(payload: string): void;
89
89
  get isAuthenticationRequired(): boolean;
90
+ connect(): Promise<unknown>;
90
91
  disconnect(): void;
91
92
  onOpen(event: Event): Promise<void>;
92
93
  getToken(): Promise<string | null>;
@@ -0,0 +1,8 @@
1
+ import * as encoding from 'lib0/encoding';
2
+ import { MessageType, OutgoingMessageArguments } from '../types';
3
+ import { OutgoingMessage } from '../OutgoingMessage';
4
+ export declare class CloseMessage extends OutgoingMessage {
5
+ type: MessageType;
6
+ description: string;
7
+ get(args: Partial<OutgoingMessageArguments>): encoding.Encoder;
8
+ }
@@ -15,7 +15,8 @@ export declare enum MessageType {
15
15
  Awareness = 1,
16
16
  Auth = 2,
17
17
  QueryAwareness = 3,
18
- Stateless = 5
18
+ Stateless = 5,
19
+ CLOSE = 7
19
20
  }
20
21
  export declare enum WebSocketStatus {
21
22
  Connecting = "connecting",
@@ -23,10 +23,14 @@ export declare class Connection {
23
23
  * Constructor.
24
24
  */
25
25
  constructor(connection: WebSocket, request: HTTPIncomingMessage, document: Document, timeout: number, socketId: string, context: any, readOnly: boolean | undefined, logger: Debugger);
26
+ boundClose: (event?: CloseEvent | undefined) => void;
27
+ boundHandleMessage: (data: Uint8Array) => void;
28
+ boundHandlePong: () => void;
29
+ handlePong(): void;
26
30
  /**
27
31
  * Set a callback that will be triggered when the connection is closed
28
32
  */
29
- onClose(callback: (document: Document) => void): Connection;
33
+ onClose(callback: (document: Document, event?: CloseEvent) => void): Connection;
30
34
  /**
31
35
  * Set a callback that will be triggered when an stateless message is received
32
36
  */
@@ -13,7 +13,8 @@ export declare enum MessageType {
13
13
  QueryAwareness = 3,
14
14
  SyncReply = 4,
15
15
  Stateless = 5,
16
- BroadcastStateless = 6
16
+ BroadcastStateless = 6,
17
+ CLOSE = 7
17
18
  }
18
19
  export interface AwarenessUpdate {
19
20
  added: Array<any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hocuspocus/extension-redis",
3
- "version": "2.0.0-alpha.0",
3
+ "version": "2.0.0-alpha.1",
4
4
  "description": "Scale Hocuspocus horizontally with Redis",
5
5
  "homepage": "https://hocuspocus.dev",
6
6
  "keywords": [
@@ -32,7 +32,7 @@
32
32
  "@types/redlock": "^4.0.3"
33
33
  },
34
34
  "dependencies": {
35
- "@hocuspocus/server": "^2.0.0-alpha.0",
35
+ "@hocuspocus/server": "^2.0.0-alpha.1",
36
36
  "ioredis": "^4.28.2",
37
37
  "kleur": "^4.1.4",
38
38
  "lodash.debounce": "^4.0.8",