Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@signalwire/js

Package Overview
Dependencies
Maintainers
9
Versions
366
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@signalwire/js - npm Package Compare versions

Comparing version 3.27.0-dev.202405091746.b811a98.0 to 3.27.0-dev.202405171235.229320b.0

dist/js/src/fabric/CallFabricRoomSession.d.ts

3

dist/core/src/BaseComponent.d.ts

@@ -53,3 +53,2 @@ import type { Task } from '@redux-saga/types';

sessionEmitter: EventEmitter<import("./utils/interfaces").ClientEvents, any>;
unifiedEventing: boolean | undefined;
dispatch: import("redux").Dispatch<import("redux").AnyAction>;

@@ -72,4 +71,2 @@ getState(): any;

/** @internal */
get unifiedEventing(): boolean | undefined;
/** @internal */
get emitter(): EventEmitter<EventTypes, any>;

@@ -76,0 +73,0 @@ /** @internal */

@@ -21,3 +21,2 @@ import { SWCloseEvent } from './utils';

reauthenticate?(): Promise<void>;
unifiedEventing: boolean;
protected _rpcConnectResult: RPCConnectResult;

@@ -24,0 +23,0 @@ private _requests;

@@ -29,3 +29,2 @@ import { Saga, Task } from '@redux-saga/core';

sessionEmitter: import("eventemitter3").EventEmitter<import("../utils/interfaces").ClientEvents, any>;
unifiedEventing: boolean | undefined;
dispatch: import("redux").Dispatch<import("redux").AnyAction>;

@@ -32,0 +31,0 @@ getState(): any;

@@ -41,11 +41,3 @@ declare type WithToken = {

};
export declare const RPCConnectUnified: (params: RPCConnectParams) => {
id: string;
method: import("..").JSONRPCMethod;
params: {
[key: string]: any;
};
jsonrpc: "2.0";
};
export {};
//# sourceMappingURL=RPCConnect.d.ts.map

@@ -28,3 +28,2 @@ /// <reference types="jest" />

sessionEmitter: EventEmitter<import(".").ClientEvents, any>;
unifiedEventing: boolean | undefined;
dispatch: import("redux").Dispatch<import("redux").AnyAction>;

@@ -59,3 +58,2 @@ getState(): any;

sessionEmitter: EventEmitter<import(".").ClientEvents, any>;
unifiedEventing: boolean | undefined;
dispatch: import("redux").Dispatch<import("redux").AnyAction>;

@@ -62,0 +60,0 @@ getState(): any;

@@ -20,3 +20,3 @@ import type { SwEvent, VideoPosition } from '.';

export declare type InternalVideoMemberUpdatableProps = typeof INTERNAL_MEMBER_UPDATABLE_PROPS;
export declare const INTERNAL_MEMBER_UPDATED_EVENTS: ("video.member.updated.audio_muted" | "video.member.updated.video_muted" | "video.member.updated.deaf" | "video.member.updated.visible" | "video.member.updated.input_volume" | "video.member.updated.output_volume" | "video.member.updated.input_sensitivity")[];
export declare const INTERNAL_MEMBER_UPDATED_EVENTS: ("video.member.updated.deaf" | "video.member.updated.audio_muted" | "video.member.updated.video_muted" | "video.member.updated.visible" | "video.member.updated.input_volume" | "video.member.updated.output_volume" | "video.member.updated.input_sensitivity")[];
declare type VideoMemberUpdatableProps = {

@@ -23,0 +23,0 @@ [K in keyof InternalVideoMemberUpdatableProps as SnakeToCamelCase<K>]: InternalVideoMemberUpdatableProps[K];

@@ -16,3 +16,3 @@ /// <reference types="node" />

export declare type SubscriberMethod = 'subscriber.online' | 'subscriber.offline';
export declare type JSONRPCMethod = 'signalwire.connect' | 'signalwire.ping' | 'signalwire.disconnect' | 'signalwire.event' | 'signalwire.reauthenticate' | 'signalwire.subscribe' | 'signalwire.unsubscribe' | SubscriberMethod | WebRTCMethod | RoomMethod | UnifiedRoomMethod | VertoMethod | ChatJSONRPCMethod | MessagingJSONRPCMethod | VoiceJSONRPCMethod | ClientContextMethod;
export declare type JSONRPCMethod = 'signalwire.connect' | 'signalwire.ping' | 'signalwire.disconnect' | 'signalwire.event' | 'signalwire.reauthenticate' | 'signalwire.subscribe' | 'signalwire.unsubscribe' | SubscriberMethod | WebRTCMethod | RoomMethod | CallFabricMethod | VertoMethod | ChatJSONRPCMethod | MessagingJSONRPCMethod | VoiceJSONRPCMethod | ClientContextMethod;
export declare type JSONRPCSubscribeMethod = Extract<JSONRPCMethod, 'signalwire.subscribe' | 'chat.subscribe'>;

@@ -52,7 +52,2 @@ export declare type JSONRPCUnSubscribeMethod = Extract<JSONRPCMethod, 'signalwire.unsubscribe'>;

sessionChannel?: SessionChannel;
/**
* @internal
* Unified eventing is required only with Call Fabric SDK
* */
unifiedEventing?: boolean;
instanceMap?: InstanceMap;

@@ -185,5 +180,5 @@ }

/**
* List of all Unified Room methods
* List of all Call Fabric methods
*/
export declare type UnifiedRoomMethod = 'call.mute' | 'call.unmute' | 'call.deaf' | 'call.undeaf' | 'call.layout.list' | 'call.member.list' | 'call.member.remove' | 'call.layout.set' | 'call.microphone.volume.set' | 'call.microphone.sensitivity.set';
export declare type CallFabricMethod = 'call.mute' | 'call.unmute' | 'call.deaf' | 'call.undeaf' | 'call.layout.list' | 'call.member.list' | 'call.member.remove' | 'call.layout.set' | 'call.microphone.volume.set' | 'call.microphone.sensitivity.set';
export interface WebSocketClient {

@@ -190,0 +185,0 @@ addEventListener: WebSocket['addEventListener'];

@@ -16,3 +16,2 @@ import { BaseComponentContract, BaseComponentOptions, BaseConnectionContract, SDKWorker } from '@signalwire/core';

leave(): Promise<void>;
start(): Promise<BaseRoomSession<T>>;
}

@@ -19,0 +18,0 @@ export interface BaseRoomSessionOptions extends BaseConnection<RoomSessionObjectEvents> {

@@ -25,3 +25,2 @@ import { BaseClient, ClientEvents, ClientContract } from '@signalwire/core';

localStream?: MediaStream;
unifiedEventing?: boolean;
}

@@ -28,0 +27,0 @@ export declare class ClientAPI<RoomSessionType = RoomSession> extends BaseClient<ClientEvents> {

@@ -1,28 +0,15 @@

interface ClientOptions {
host?: string;
accessToken: string;
import { BaseClient, ClientEvents } from '@signalwire/core';
import { MakeRoomOptions } from '../video';
export declare class Client extends BaseClient<ClientEvents> {
makeCallFabricObject(makeRoomOptions: MakeRoomOptions): import("./CallFabricRoomSession").CallFabricRoomSession;
/**
* Reauthenticate with the SignalWire network using a new token
* For now it returns void since with an invalid token the server
* will close the connection right away so we can hook on the session
* events in case. Need to improve it.
*
* @internal
*/
reauthenticate(token: string): void;
}
/**
*
*
* // TODO: Remove this file
* Replaced by SWClient.ts
*
*/
export declare class Client {
options: ClientOptions;
private httpClient;
constructor(options: ClientOptions);
get host(): string;
getAddresses(): Promise<{
addresses: any;
nextPage: () => Promise<any | undefined>;
prevPage: () => Promise<any | undefined>;
}>;
createCall({ uri, ...userParams }: {
uri: string;
rootElement: HTMLElement;
}): Promise<import("../RoomSession").RoomSession>;
}
export {};
//# sourceMappingURL=Client.d.ts.map

@@ -1,3 +0,2 @@

import { BaseRoomSession } from '../BaseRoomSession';
import { RoomSession } from '../RoomSession';
import { CallFabricRoomSession } from './CallFabricRoomSession';
import { CallOptions, IncomingCallHandlers, IncomingInvite } from './types';

@@ -9,3 +8,3 @@ export declare class IncomingCallManager {

private _handlers;
constructor(_buildCallObject: (invite: IncomingInvite, params: CallOptions) => BaseRoomSession<RoomSession>, _executeReject: (callId: string, nodeId: string) => Promise<void>);
constructor(_buildCallObject: (invite: IncomingInvite, params: CallOptions) => CallFabricRoomSession, _executeReject: (callId: string, nodeId: string) => Promise<void>);
private _buildNotification;

@@ -12,0 +11,0 @@ setNotificationHandlers(handlers: IncomingCallHandlers): void;

@@ -1,3 +0,1 @@

export * from './Client';
export * from './SWClient';
export * from './WSClient';

@@ -4,0 +2,0 @@ export * from './HTTPClient';

import { type UserOptions } from '@signalwire/core';
import { BaseRoomSession } from '../BaseRoomSession';
import { RoomSession } from '../video';
import { HTTPClient } from './HTTPClient';
import { WSClient } from './WSClient';
import { Conversation } from './Conversation';
import { CallFabricRoomSession } from './CallFabricRoomSession';
export interface SignalWireOptions extends WSClientOptions {

@@ -85,3 +84,3 @@ }

details: IncomingInvite;
accept: (param: CallOptions) => Promise<BaseRoomSession<RoomSession>>;
accept: (param: CallOptions) => Promise<CallFabricRoomSession>;
reject: () => Promise<void>;

@@ -88,0 +87,0 @@ };

import { SDKWorker, SDKWorkerParams } from '@signalwire/core';
import { CallFabricRoomSessionConnection } from '../CallFabricBaseRoomSession';
import { CallFabricRoomSessionConnection } from '../CallFabricRoomSession';
export declare type CallFabricWorkerParams<T> = SDKWorkerParams<CallFabricRoomSessionConnection> & {

@@ -4,0 +4,0 @@ action: T;

import { SDKWorker } from '@signalwire/core';
import { Client } from '../Client';
export declare const conversationWorker: SDKWorker<Client>;
import { WSClient } from '../WSClient';
export declare const conversationWorker: SDKWorker<WSClient>;
//# sourceMappingURL=conversationWorker.d.ts.map

@@ -1,6 +0,4 @@

import { Client } from '../Client';
import { RoomSession } from '../RoomSession';
import { DialParams, OnlineParams, PushNotificationPayload, WSClientOptions } from './types';
import { BaseRPCResult } from '@signalwire/core';
import { BaseRoomSession } from '../BaseRoomSession';
import { CallFabricRoomSession } from './CallFabricRoomSession';
import { Client } from './Client';
export declare class WSClient {

@@ -13,6 +11,6 @@ options: WSClientOptions;

/** @internal */
get clientApi(): Client<RoomSession>;
get clientApi(): Client;
connect(): Promise<void>;
disconnect(): void;
dial(params: DialParams): Promise<BaseRoomSession<RoomSession>>;
dial(params: DialParams): Promise<CallFabricRoomSession>;
handlePushNotification(payload: PushNotificationPayload): Promise<unknown>;

@@ -30,8 +28,8 @@ private notifyIncomingInvite;

*/
online({ incomingCallHandlers }: OnlineParams): Promise<BaseRPCResult>;
online({ incomingCallHandlers }: OnlineParams): Promise<void>;
/**
* Mark the client as 'offline' to receive calls over WebSocket
*/
offline(): Promise<BaseRPCResult>;
offline(): Promise<void>;
}
//# sourceMappingURL=WSClient.d.ts.map

@@ -56,3 +56,3 @@ /**

export * as Fabric from './fabric';
export { SWClient, SignalWire } from './fabric';
export { SignalWire } from './fabric';
export * from './fabric/types';

@@ -59,0 +59,0 @@ /**

@@ -24,3 +24,2 @@ /// <reference types="jest" />

sessionEmitter: EventEmitter<import("@signalwire/core").ClientEvents, any>;
unifiedEventing: boolean | undefined;
dispatch: import("redux").Dispatch<import("redux").AnyAction>;

@@ -55,3 +54,2 @@ getState(): any;

sessionEmitter: EventEmitter<import("@signalwire/core").ClientEvents, any>;
unifiedEventing: boolean | undefined;
dispatch: import("redux").Dispatch<import("redux").AnyAction>;

@@ -58,0 +56,0 @@ getState(): any;

@@ -21,3 +21,3 @@ import type { Rooms, BaseConnectionState, InternalVideoLayout, VideoLayoutEventNames, VideoRoomSessionEventNames, VideoRoomEventParams, InternalVideoMemberEntity, InternalVideoMemberEntityUpdated, VideoMemberEventNames, MemberUpdated, MemberUpdatedEventNames, MemberTalkingEventNames, VideoMemberTalkingEventParams, RTCTrackEventName, VideoRecordingEventNames, VideoPlaybackEventNames, RoomSessionRecording, RoomSessionPlayback, VideoRoomSessionContract, OnlyFunctionProperties, MemberListUpdated, VideoPositions, RoomAudienceCount, VideoRoomAudienceCountEventParams, RoomLeft, RoomLeftEventParams, VideoStreamEventNames, RoomSessionStream, RoomJoined, RoomSubscribed, VideoRoomSubscribedEventParams, VideoAuthorization, VideoRoomDeviceUpdatedEventNames, DeviceUpdatedEventParams, VideoRoomDeviceDisconnectedEventNames, DeviceDisconnectedEventParams, VideoRoomDeviceEventNames, InternalUnifiedMethodTarget } from '@signalwire/core';

declare type VideoLayout = InternalVideoLayout;
declare const INTERNAL_MEMBER_UPDATED_EVENTS: ("member.updated.audio_muted" | "member.updated.video_muted" | "member.updated.deaf" | "member.updated.visible" | "member.updated.input_volume" | "member.updated.output_volume" | "member.updated.input_sensitivity")[];
declare const INTERNAL_MEMBER_UPDATED_EVENTS: ("member.updated.deaf" | "member.updated.visible" | "member.updated.audio_muted" | "member.updated.video_muted" | "member.updated.input_volume" | "member.updated.output_volume" | "member.updated.input_sensitivity")[];
/** @deprecated */

@@ -339,7 +339,7 @@ export declare type DeprecatedMemberUpdatableProps = (typeof INTERNAL_MEMBER_UPDATED_EVENTS)[number];

};
export interface AudioElement extends HTMLAudioElement {
export declare type AudioElement = HTMLAudioElement & {
sinkId?: string;
setSinkId?: (id: string) => Promise<void>;
}
};
export {};
//# sourceMappingURL=interfaces.d.ts.map

@@ -35,3 +35,3 @@ import { BaseComponent, BaseComponentOptions, BaseConnectionState, Rooms, EventEmitter, BaseConnectionContract, WebRTCMethod } from '@signalwire/core';

private sessionAuthTask;
private resuming;
protected resuming: boolean;
constructor(options: BaseConnectionOptions);

@@ -38,0 +38,0 @@ get id(): string;

@@ -6,3 +6,3 @@ {

"license": "MIT",
"version": "3.27.0-dev.202405091746.b811a98.0",
"version": "3.27.0-dev.202405171235.229320b.0",
"main": "dist/index.js",

@@ -43,4 +43,4 @@ "module": "dist/index.esm.js",

"dependencies": {
"@signalwire/core": "4.1.0-dev.202405091746.b811a98.0",
"@signalwire/webrtc": "3.12.1-dev.202405091746.b811a98.0",
"@signalwire/core": "4.1.0-dev.202405171235.229320b.0",
"@signalwire/webrtc": "3.12.1-dev.202405171235.229320b.0",
"jwt-decode": "^3.1.2"

@@ -47,0 +47,0 @@ },

@@ -68,5 +68,2 @@ import {

leave(): Promise<void>
// FIXME: This should only be added for CF SDK
start(): Promise<BaseRoomSession<T>>
}

@@ -73,0 +70,0 @@

@@ -23,3 +23,2 @@ import {

import type { RoomSession } from './RoomSession'
import { createCallFabricBaseRoomSessionObject } from './fabric/CallFabricBaseRoomSession'

@@ -46,3 +45,2 @@ export interface Client<RoomSessionType = RoomSession>

localStream?: MediaStream
unifiedEventing?: boolean
}

@@ -65,3 +63,2 @@

stopMicrophoneWhileMuted = true,
unifiedEventing = false,
...options

@@ -96,8 +93,3 @@ } = makeRoomOptions

let roomSessionObject = createBaseRoomSessionObject
if (unifiedEventing) {
roomSessionObject = createCallFabricBaseRoomSessionObject
}
const room = roomSessionObject<RoomSessionType>({
const room = createBaseRoomSessionObject<RoomSessionType>({
...options,

@@ -104,0 +96,0 @@ store: this.store,

@@ -10,3 +10,2 @@ import {

import { JWTSession } from './JWTSession'
import { SATSession } from './SATSession'

@@ -42,3 +41,3 @@ /**

userOptions: baseUserOptions,
SessionConstructor: baseUserOptions.unifiedEventing ? SATSession : JWTSession,
SessionConstructor: JWTSession,
})

@@ -45,0 +44,0 @@ const client = connect<

@@ -1,80 +0,101 @@

import { createHttpClient } from './createHttpClient'
import { buildCall } from './buildCall'
import { BaseClient, ClientEvents, actions } from '@signalwire/core'
import type { CustomSaga } from '@signalwire/core'
import { MakeRoomOptions } from '../video'
import { createCallFabricRoomSessionObject } from './CallFabricRoomSession'
import {
makeAudioElementSaga,
makeVideoElementSaga,
} from '../features/mediaElements/mediaElementsSagas'
import { RoomSessionConnection } from '../BaseRoomSession'
interface ClientOptions {
host?: string
accessToken: string
}
export class Client extends BaseClient<ClientEvents> {
makeCallFabricObject(makeRoomOptions: MakeRoomOptions) {
const {
rootElement,
applyLocalVideoOverlay = true,
stopCameraWhileMuted = true,
stopMicrophoneWhileMuted = true,
...options
} = makeRoomOptions
/**
*
*
* // TODO: Remove this file
* Replaced by SWClient.ts
*
*/
export class Client {
private httpClient: ReturnType<typeof createHttpClient>
// TODO: This might not be needed here. We can initiate these sagas in the BaseRoomSession constructor.
const customSagas: Array<CustomSaga<RoomSessionConnection>> = []
constructor(public options: ClientOptions) {
this.httpClient = createHttpClient({
baseUrl: `https://${this.host}`,
headers: {
Authorization: `Bearer ${this.options.accessToken}`,
},
/**
* By default the SDK will attach the audio to
* an Audio element (regardless of "rootElement")
*/
customSagas.push(
makeAudioElementSaga({
speakerId: options.speakerId,
})
)
/**
* If the user provides a `rootElement` we'll
* automatically handle the Video element for them
*/
if (rootElement) {
customSagas.push(
makeVideoElementSaga({
rootElement,
applyLocalVideoOverlay,
})
)
}
const room = createCallFabricRoomSessionObject({
...options,
store: this.store,
customSagas,
})
}
get host() {
return this.options.host ?? 'fabric.signalwire.com'
}
async getAddresses() {
const path = '/addresses' as const
const { body } = await this.httpClient<any>(path)
const anotherPage = async (url: string) => {
const { search } = new URL(url)
const { body } = await this.httpClient<any>(`${path}${search}`)
return buildResult(body)
/**
* Stop and Restore outbound audio on audio_muted event
*/
if (stopMicrophoneWhileMuted) {
room.on('member.updated.audio_muted', ({ member }) => {
try {
if (member.id === room.memberId && 'audio_muted' in member) {
member.audio_muted
? room.stopOutboundAudio()
: room.restoreOutboundAudio()
}
} catch (error) {
this.logger.error('Error handling audio_muted', error)
}
})
}
const buildResult = (body: any) => {
return {
addresses: body.data,
nextPage: async () => {
const { next } = body.links
return next ? anotherPage(next) : undefined
},
prevPage: async () => {
const { prev } = body.links
return prev ? anotherPage(prev) : undefined
},
}
/**
* Stop and Restore outbound video on video_muted event
*/
if (stopCameraWhileMuted) {
room.on('member.updated.video_muted', ({ member }) => {
try {
if (member.id === room.memberId && 'video_muted' in member) {
member.video_muted
? room.stopOutboundVideo()
: room.restoreOutboundVideo()
}
} catch (error) {
this.logger.error('Error handling video_muted', error)
}
})
}
return buildResult(body)
return room
}
async createCall({
uri,
...userParams
}: {
uri: string
rootElement: HTMLElement
}) {
const path = '/call' as const
const { body } = await this.httpClient<any>(path, {
method: 'POST',
body: { uri },
})
console.log('Dial Response', body)
return buildCall({
...body,
userParams: {
host: this.host.includes('swire') ? 'relay.swire.io' : undefined,
...userParams,
},
})
/**
* Reauthenticate with the SignalWire network using a new token
* For now it returns void since with an invalid token the server
* will close the connection right away so we can hook on the session
* events in case. Need to improve it.
*
* @internal
*/
reauthenticate(token: string) {
this.store.dispatch(actions.reauthAction({ token }))
}
}

@@ -35,3 +35,2 @@ import { HTTPClient } from './HTTPClient'

// @ts-expect-error
this.wsClient.clientApi.runWorker('conversationWorker', {

@@ -38,0 +37,0 @@ worker: conversationWorker,

@@ -1,3 +0,2 @@

import { BaseRoomSession } from '../BaseRoomSession'
import { RoomSession } from '../RoomSession'
import { CallFabricRoomSession } from './CallFabricRoomSession'
import {

@@ -18,3 +17,3 @@ CallOptions,

params: CallOptions
) => BaseRoomSession<RoomSession>,
) => CallFabricRoomSession,
private _executeReject: (callId: string, nodeId: string) => Promise<void>

@@ -25,7 +24,6 @@ ) {}

const accept = async (params: CallOptions) => {
return new Promise<BaseRoomSession<RoomSession>>((resolve, reject) => {
return new Promise<CallFabricRoomSession>((resolve, reject) => {
delete this._pendingInvites[invite.callID]
try {
const call = this._buildCallObject(invite, params)
//@ts-expect-error
call.answer()

@@ -32,0 +30,0 @@

@@ -1,3 +0,1 @@

export * from './Client'
export * from './SWClient'
export * from './WSClient'

@@ -4,0 +2,0 @@ export * from './HTTPClient'

import { type UserOptions } from '@signalwire/core'
import { BaseRoomSession } from '../BaseRoomSession'
import { RoomSession } from '../video'
import { HTTPClient } from './HTTPClient'
import { WSClient } from './WSClient'
import { Conversation } from './Conversation'
import { CallFabricRoomSession } from './CallFabricRoomSession'

@@ -94,3 +93,3 @@ export interface SignalWireOptions extends WSClientOptions {}

details: IncomingInvite
accept: (param: CallOptions) => Promise<BaseRoomSession<RoomSession>>
accept: (param: CallOptions) => Promise<CallFabricRoomSession>
reject: () => Promise<void>

@@ -97,0 +96,0 @@ }

@@ -13,3 +13,3 @@ import {

} from '@signalwire/core'
import { CallFabricRoomSessionConnection } from '../CallFabricBaseRoomSession'
import { CallFabricRoomSessionConnection } from '../CallFabricRoomSession'
import * as videoWorkers from '../../video/workers'

@@ -123,3 +123,2 @@ import { callJoinWorker } from './callJoinWorker'

}
}

@@ -11,3 +11,3 @@ import {

import { Conversation } from '../Conversation'
import { Client } from '../Client'
import { WSClient } from '../WSClient'

@@ -18,3 +18,3 @@ interface ConversationWorkerInitialState {

export const conversationWorker: SDKWorker<Client> = function* (
export const conversationWorker: SDKWorker<WSClient> = function* (
options

@@ -21,0 +21,0 @@ ): SagaIterator {

import { getLogger, VertoSubscribe, VertoBye } from '@signalwire/core'
import { Client } from '../Client'
import { RoomSession } from '../RoomSession'
import { createClient } from '../createClient'
import { wsClientWorker } from './workers'

@@ -16,7 +13,8 @@ import {

import { IncomingCallManager } from './IncomingCallManager'
import { BaseRPCResult } from '@signalwire/core'
import { BaseRoomSession } from '../BaseRoomSession'
import { CallFabricRoomSession } from './CallFabricRoomSession'
import { createClient } from './createClient'
import { Client } from './Client'
export class WSClient {
private wsClient: Client<RoomSession>
private wsClient: Client
private logger = getLogger()

@@ -26,6 +24,3 @@ private _incomingCallManager: IncomingCallManager

constructor(public options: WSClientOptions) {
this.wsClient = createClient<RoomSession>({
...this.options,
unifiedEventing: true,
})
this.wsClient = createClient(this.options)
this._incomingCallManager = new IncomingCallManager(

@@ -63,44 +58,41 @@ (payload: IncomingInvite, params: CallOptions) =>

async dial(params: DialParams) {
return new Promise<BaseRoomSession<RoomSession>>(
async (resolve, reject) => {
try {
await this.connect()
const call = this.wsClient.rooms.makeRoomObject({
audio: params.audio ?? true,
video: params.video ?? true,
negotiateAudio: true,
negotiateVideo: true,
// iceServers,
rootElement: params.rootElement || this.options.rootElement,
applyLocalVideoOverlay: true,
stopCameraWhileMuted: true,
stopMicrophoneWhileMuted: true,
// speakerId,
destinationNumber: params.to,
watchMediaPackets: false,
// watchMediaPacketsTimeout:,
nodeId: params.nodeId,
disableUdpIceServers: params.disableUdpIceServers || false,
unifiedEventing: true,
})
return new Promise<CallFabricRoomSession>(async (resolve, reject) => {
try {
await this.connect()
const call = this.wsClient.makeCallFabricObject({
audio: params.audio ?? true,
video: params.video ?? true,
negotiateAudio: true,
negotiateVideo: true,
// iceServers,
rootElement: params.rootElement || this.options.rootElement,
applyLocalVideoOverlay: true,
stopCameraWhileMuted: true,
stopMicrophoneWhileMuted: true,
// speakerId,
destinationNumber: params.to,
watchMediaPackets: false,
// watchMediaPacketsTimeout:,
nodeId: params.nodeId,
disableUdpIceServers: params.disableUdpIceServers || false,
})
// WebRTC connection left the room.
call.once('destroy', () => {
this.logger.debug('RTC Connection Destroyed')
})
// WebRTC connection left the room.
call.once('destroy', () => {
this.logger.debug('RTC Connection Destroyed')
})
this.wsClient.once('session.disconnected', () => {
this.logger.debug('Session Disconnected')
})
this.wsClient.once('session.disconnected', () => {
this.logger.debug('Session Disconnected')
})
// @ts-expect-error
call.attachPreConnectWorkers()
// @ts-expect-error
call.attachPreConnectWorkers()
resolve(call)
} catch (error) {
getLogger().error('WSClient dial', error)
reject(error)
}
resolve(call)
} catch (error) {
getLogger().error('WSClient dial', error)
reject(error)
}
)
})
}

@@ -169,4 +161,3 @@

try {
// @ts-expect-error
return await this.wsClient.execute({
return await this.wsClient.execute<unknown, void>({
method: 'webrtc.verto',

@@ -191,4 +182,3 @@ params: {

try {
// @ts-expect-error
return await this.wsClient.execute({
return await this.wsClient.execute<unknown, void>({
method: 'webrtc.verto',

@@ -216,3 +206,3 @@ params: {

const call = this.wsClient.rooms.makeRoomObject({
const call = this.wsClient.makeCallFabricObject({
audio: params.audio ?? true,

@@ -231,3 +221,2 @@ video: params.video ?? true,

disableUdpIceServers: params.disableUdpIceServers || false,
unifiedEventing: true,
})

@@ -259,4 +248,2 @@

})
// @ts-expect-error
this.wsClient.reauthenticate(token)

@@ -269,9 +256,6 @@ })

*/
async online({ incomingCallHandlers }: OnlineParams): Promise<BaseRPCResult> {
async online({ incomingCallHandlers }: OnlineParams) {
this._incomingCallManager.setNotificationHandlers(incomingCallHandlers)
await this.connect()
//@ts-expect-error
return this.wsClient.execute({
return this.wsClient.execute<unknown, void>({
method: 'subscriber.online',

@@ -285,6 +269,5 @@ params: {},

*/
offline(): Promise<BaseRPCResult> {
offline() {
this._incomingCallManager.setNotificationHandlers({})
// @ts-expect-error
return this.wsClient.execute({
return this.wsClient.execute<unknown, void>({
method: 'subscriber.offline',

@@ -291,0 +274,0 @@ params: {},

@@ -62,3 +62,3 @@ /**

export * as Fabric from './fabric'
export { SWClient, SignalWire } from './fabric'
export { SignalWire } from './fabric'
export * from './fabric/types'

@@ -65,0 +65,0 @@

@@ -468,5 +468,5 @@ import type {

export interface AudioElement extends HTMLAudioElement {
export type AudioElement = HTMLAudioElement & {
sinkId?: string
setSinkId?: (id: string) => Promise<void>
}

@@ -58,3 +58,3 @@ import {

const currentCallSegment = callSegments[callSegments.length - 1]
if (payload.member.member_id === currentCallSegment.memberId) {
if (payload.member.member_id === currentCallSegment?.memberId) {
// FIXME: We should emit the RoomSessionMember instance

@@ -61,0 +61,0 @@ // @ts-expect-error

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc