add mailboxes

This commit is contained in:
marlon-erler
2024-07-08 21:13:56 +02:00
parent 85164a4e0a
commit b88959e135
16 changed files with 342 additions and 79 deletions
+19 -2
View File
@@ -35,10 +35,18 @@ UDN.unsubscribe("my-channel");
```TypeScript
export interface Message {
// connecting to server
requestingServerConnection?: boolean;
// mailbox
requestingMailboxSetup?: boolean;
assignedMailboxId?: string; // sent by server
requestedMailbox?: string;
// subscribing to channel
subscribeChannel?: string;
unsubscribeChannel?: string;
subscribed?: boolean; // sent by the server to confirm subscription
subscribed?: boolean; // sent by server to confirm subscription
//sending message
messageChannel?: string;
@@ -46,7 +54,7 @@ export interface Message {
}
export default class UDNFrontend {
private ws: WebSocket | undefined;
ws: WebSocket | undefined;
// handlers
private connectionHandler = () => {};
@@ -60,6 +68,7 @@ export default class UDNFrontend {
// methods
connect(address: string): void;
disconnect(address: string): void;
sendMessage(channel: string, body: string): boolean; // true if message is sent
subscribe(channel: string): boolean; // true if request is sent, NOT inherently when subscribed
unsubscribe(channel: string): boolean; // true if request is sent, NOT inherently when unsubscribed
@@ -75,3 +84,11 @@ export default class UDNFrontend {
## 1.0.2
- minor fixes
## 1.0.3
- add `disconnect()` method
## 1.0.4
- make ws public