Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doximity rtc peer connection keyword modified to public from readonly #3415

Closed
Show file tree
Hide file tree
Changes from all 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
17 changes: 16 additions & 1 deletion packages/hms-video-store/src/connection/HMSConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,27 @@ import { enableOpusDtx, fixMsid } from '../utils/session-description';

const TAG = '[HMSConnection]';

/**
* Abstract base class that handles WebRTC peer connections for 100ms SDK
* Provides common functionality for both publishing (sending) and subscribing (receiving) connections
*/
export default abstract class HMSConnection {
/**
* Indicates whether this connection is for publishing or subscribing media
*/
readonly role: HMSConnectionRole;

protected readonly signal: JsonRpcSignal;

protected abstract readonly observer: IConnectionObserver;
abstract readonly nativeConnection: RTCPeerConnection;

/**
* The native WebRTC peer connection object
* @abstract
* @type {RTCPeerConnection}
*/
abstract nativeConnection: RTCPeerConnection;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can be readonly so that it shouldn't be allowed to be modified. They just need a read access which we don't expose directly.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

 private getNativePublishPeerConnection() {
    return this.transport.getPublishConnection()?.nativeConnection;
  }

Just adding two methods - one for publish and other for subscribe in sdk/index and HMSSDKActions should be enough. we can even combine this to getNativePeerConnections and return and object with publish and subscribe

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should add validations whether join has happened or not and throwing an error suggesting to call post joiin.


/**
* We keep a list of pending IceCandidates received
* from the signalling server. When the peer-connection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,23 @@ import HMSLogger from '../../utils/logger';
import HMSConnection from '../HMSConnection';
import { HMSConnectionRole } from '../model';

/**
* Represents a connection for publishing media to the signalling server.
* Extends the HMSConnection class to provide additional functionality for publishing media
* @extends {HMSConnection}
*/
export default class HMSPublishConnection extends HMSConnection {
private readonly TAG = '[HMSPublishConnection]';
protected readonly observer: IPublishConnectionObserver;
readonly nativeConnection: RTCPeerConnection;
/**
* The native WebRTC peer connection object
* @type {RTCPeerConnection}
*/
nativeConnection: RTCPeerConnection;
/**
* The data channel used for communication with the signalling server
* @type {RTCDataChannel}
*/
readonly channel: RTCDataChannel;

constructor(signal: JsonRpcSignal, config: RTCConfiguration, observer: IPublishConnectionObserver) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,22 @@ import HMSConnection from '../HMSConnection';
import HMSDataChannel from '../HMSDataChannel';
import { HMSConnectionRole } from '../model';

/**
* Represents a connection for subscribing to media from the signalling server.
* Extends the HMSConnection class to provide additional functionality for subscribing to media
* @extends {HMSConnection}
*/
export default class HMSSubscribeConnection extends HMSConnection {
private readonly TAG = '[HMSSubscribeConnection]';
private readonly remoteStreams = new Map<string, HMSRemoteStream>();
protected readonly observer: ISubscribeConnectionObserver;
private readonly MAX_RETRIES = 3;

readonly nativeConnection: RTCPeerConnection;
/**
* The native WebRTC peer connection object
* @type {RTCPeerConnection}
*/
nativeConnection: RTCPeerConnection;

private pendingMessageQueue: string[] = [];

Expand Down
Loading