Skip to content

Commit dbe7584

Browse files
committed
regen
1 parent a85dc81 commit dbe7584

File tree

6 files changed

+415
-6
lines changed

6 files changed

+415
-6
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Change Log
22

3+
## 21.3.0
4+
5+
* Add new `Realtime` service with methods for subscribing to channels and receiving messages
6+
* Fix `client.setSession` not working when using realtime
7+
* Deprecate `client.subscribe` method in favor of `Realtime` service
8+
9+
> Note: Deprecated methods are still available for backwards compatibility, but might be removed in future versions.
10+
311
## 21.2.1
412

513
* Add transaction support for Databases and TablesDB

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import { Client, Account } from "appwrite";
3333
To install with a CDN (content delivery network) add the following scripts to the bottom of your <body> tag, but before you use any Appwrite services:
3434

3535
```html
36-
<script src="https://cdn.jsdelivr.net/npm/appwrite@21.2.1"></script>
36+
<script src="https://cdn.jsdelivr.net/npm/appwrite@21.3.0"></script>
3737
```
3838

3939

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "appwrite",
33
"homepage": "https://appwrite.io/support",
44
"description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API",
5-
"version": "21.2.1",
5+
"version": "21.3.0",
66
"license": "BSD-3-Clause",
77
"main": "dist/cjs/sdk.js",
88
"exports": {

src/client.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ class Client {
316316
'x-sdk-name': 'Web',
317317
'x-sdk-platform': 'client',
318318
'x-sdk-language': 'web',
319-
'x-sdk-version': '21.2.1',
319+
'x-sdk-version': '21.3.0',
320320
'X-Appwrite-Response-Format': '1.8.0',
321321
};
322322

@@ -528,10 +528,13 @@ class Client {
528528
this.realtime.lastMessage = message;
529529
switch (message.type) {
530530
case 'connected':
531-
const cookie = JSON.parse(window.localStorage.getItem('cookieFallback') ?? '{}');
532-
const session = cookie?.[`a_session_${this.config.project}`];
533-
const messageData = <RealtimeResponseConnected>message.data;
531+
let session = this.config.session;
532+
if (!session) {
533+
const cookie = JSON.parse(window.localStorage.getItem('cookieFallback') ?? '{}');
534+
session = cookie?.[`a_session_${this.config.project}`];
535+
}
534536

537+
const messageData = <RealtimeResponseConnected>message.data;
535538
if (session && !messageData.user) {
536539
this.realtime.socket?.send(JSON.stringify(<RealtimeRequest>{
537540
type: 'authentication',
@@ -582,6 +585,9 @@ class Client {
582585
/**
583586
* Subscribes to Appwrite events and passes you the payload in realtime.
584587
*
588+
* @deprecated Use the Realtime service instead.
589+
* @see Realtime
590+
*
585591
* @param {string|string[]} channels
586592
* Channel to subscribe - pass a single channel as a string or multiple with an array of strings.
587593
*

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export { Messaging } from './services/messaging';
1616
export { Storage } from './services/storage';
1717
export { TablesDB } from './services/tables-db';
1818
export { Teams } from './services/teams';
19+
export { Realtime } from './services/realtime';
1920
export type { Models, Payload, RealtimeResponseEvent, UploadProgress } from './client';
2021
export type { QueryTypes, QueryTypesList } from './query';
2122
export { Permission } from './permission';

0 commit comments

Comments
 (0)