Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions sdk/communication/communication-chat/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Release History

## Unreleased

- Updated to @azure/[email protected].
- Enabled real-time notification for React Native.

## 1.0.0 (2021-03-29)

### Breaking Changes
Expand Down
2 changes: 1 addition & 1 deletion sdk/communication/communication-chat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"dependencies": {
"@azure/abort-controller": "^1.0.0",
"@azure/communication-common": "^1.0.0",
"@azure/communication-signaling": "1.0.0-beta.3",
"@azure/communication-signaling": "1.0.0-beta.5",
"@azure/core-auth": "^1.3.0",
"@azure/core-http": "^1.2.0",
"@azure/core-tracing": "1.0.0-preview.11",
Expand Down
4 changes: 2 additions & 2 deletions sdk/communication/communication-chat/src/chatClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ export class ChatClient {
*/
public async startRealtimeNotifications(): Promise<void> {
if (this.signalingClient === undefined) {
throw new Error("Realtime notifications are only supported in the browser.");
throw new Error("Realtime notifications are not supported in node js.");
}

if (this.isRealtimeNotificationsStarted) {
Expand All @@ -269,7 +269,7 @@ export class ChatClient {
*/
public async stopRealtimeNotifications(): Promise<void> {
if (this.signalingClient === undefined) {
throw new Error("Realtime notifications are only supported in the browser.");
throw new Error("Realtime notifications are not supported in node js.");
}

this.isRealtimeNotificationsStarted = false;
Expand Down
11 changes: 11 additions & 0 deletions sdk/communication/communication-chat/src/shims.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

// d.ts shims provide types for things we use internally but are not part
// of this package's surface area.

// Shim for DOM's navigator's product status
interface Navigator {
readonly product: string;
}
declare let navigator: Navigator;
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { SignalingClient } from "@azure/communication-signaling";
import { CommunicationSignalingClient, SignalingClient } from "@azure/communication-signaling";
import { CommunicationTokenCredential } from "@azure/communication-common";
import { AzureLogger } from "@azure/logger";

export const getSignalingClient = (
_credential: CommunicationTokenCredential,
_logger: AzureLogger
credential: CommunicationTokenCredential,
logger: AzureLogger
): SignalingClient | undefined => {
if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
// In React Native
return new CommunicationSignalingClient(credential, logger);
}

// In node js
return undefined;
};