@signalwire/js
Advanced tools
Comparing version 1.3.0-alpha.6 to 1.3.0-alpha.7
@@ -25,2 +25,3 @@ import BaseSession from './BaseSession'; | ||
checkPermissions(audio?: boolean, video?: boolean): Promise<boolean>; | ||
purge(): Promise<void>; | ||
disconnect(): Promise<void>; | ||
@@ -53,3 +54,3 @@ speedTest(bytes: number): Promise<unknown>; | ||
vertoBroadcast({ nodeId, channel, data }: BroadcastParams): any; | ||
vertoSubscribe({ nodeId, channels, handler }: SubscribeParams): Promise<any>; | ||
vertoSubscribe({ nodeId, channels }: SubscribeParams): Promise<any>; | ||
vertoUnsubscribe({ nodeId, channels }: SubscribeParams): any; | ||
@@ -59,2 +60,3 @@ _jsApi(params?: {}): any; | ||
execute(message: BaseMessage): any; | ||
protected _onSocketCloseOrError(event: any): void; | ||
} |
@@ -72,2 +72,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
} | ||
purge() { | ||
Object.keys(this.calls).forEach(k => this.calls[k].setState(State.Purge)); | ||
this.calls = {}; | ||
this._autoReconnect = false; | ||
return super.disconnect(); | ||
} | ||
disconnect() { | ||
@@ -78,5 +84,6 @@ const _super = Object.create(null, { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
Object.keys(this.calls).forEach(k => this.calls[k].setState(State.Purge)); | ||
this.calls = {}; | ||
yield _super.disconnect.call(this); | ||
const promises = Object.keys(this.calls).map(k => this.calls[k].hangup()); | ||
yield Promise.all(promises); | ||
this.purge(); | ||
return _super.disconnect.call(this); | ||
}); | ||
@@ -209,3 +216,3 @@ } | ||
} | ||
vertoSubscribe({ nodeId, channels, handler }) { | ||
vertoSubscribe({ nodeId, channels }) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -243,2 +250,6 @@ const msg = new Subscribe({ sessid: this.sessionid, eventChannel: channels }); | ||
} | ||
_onSocketCloseOrError(event) { | ||
this.purge(); | ||
super._onSocketCloseOrError(event); | ||
} | ||
} |
@@ -23,3 +23,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
import { register, deRegisterAll } from '../services/Handler'; | ||
import { checkSubscribeResponse, mutateCanvasInfoData } from './helpers'; | ||
import { mutateCanvasInfoData, destructSubscribeResponse } from './helpers'; | ||
import { ConferenceAction, Notification } from './constants'; | ||
@@ -309,13 +309,16 @@ import { mutateLiveArrayData } from '../util/helpers'; | ||
const result = yield this.session.vertoSubscribe(params); | ||
if (checkSubscribeResponse(result, laChannel)) { | ||
const { subscribed = [], alreadySubscribed = [] } = destructSubscribeResponse(result); | ||
const all = subscribed.concat(alreadySubscribed); | ||
this.channels.forEach(deRegisterAll); | ||
if (all.includes(laChannel)) { | ||
register(laChannel, this.laChannelHandler); | ||
this._bootstrap(); | ||
} | ||
if (checkSubscribeResponse(result, chatChannel)) { | ||
if (all.includes(chatChannel)) { | ||
register(chatChannel, this.chatChannelHandler); | ||
} | ||
if (checkSubscribeResponse(result, infoChannel)) { | ||
if (all.includes(infoChannel)) { | ||
register(infoChannel, this.infoChannelHandler); | ||
} | ||
if (checkSubscribeResponse(result, modChannel)) { | ||
if (all.includes(modChannel)) { | ||
register(modChannel, this.modChannelHandler); | ||
@@ -331,2 +334,3 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
this.channels.forEach(deRegisterAll); | ||
const params = { | ||
@@ -342,3 +346,2 @@ nodeId: this.nodeId, | ||
} | ||
this.channels.forEach(deRegisterAll); | ||
this._lastSerno = 0; | ||
@@ -345,0 +348,0 @@ }); |
@@ -11,3 +11,2 @@ import { CallOptions, IVertoCanvasInfo, ICanvasInfo } from './interfaces'; | ||
declare const sdpMediaOrderHack: (answer: string, localOffer: string) => string; | ||
declare const checkSubscribeResponse: (response: any, channel: string) => boolean; | ||
declare type DestructuredResult = { | ||
@@ -29,2 +28,2 @@ subscribed: string[]; | ||
declare const mutateCanvasInfoData: (canvasInfo: IVertoCanvasInfo) => ICanvasInfo; | ||
export { getUserMedia, getDevices, scanResolutions, getMediaConstraints, assureDeviceId, removeUnsupportedConstraints, checkDeviceIdConstraints, sdpStereoHack, sdpMediaOrderHack, sdpBitrateHack, checkSubscribeResponse, destructSubscribeResponse, enableAudioTracks, disableAudioTracks, toggleAudioTracks, enableVideoTracks, disableVideoTracks, toggleVideoTracks, mutateCanvasInfoData, }; | ||
export { getUserMedia, getDevices, scanResolutions, getMediaConstraints, assureDeviceId, removeUnsupportedConstraints, checkDeviceIdConstraints, sdpStereoHack, sdpMediaOrderHack, sdpBitrateHack, destructSubscribeResponse, enableAudioTracks, disableAudioTracks, toggleAudioTracks, enableVideoTracks, disableVideoTracks, toggleVideoTracks, mutateCanvasInfoData, }; |
@@ -186,9 +186,2 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
}; | ||
const checkSubscribeResponse = (response, channel) => { | ||
if (!response) { | ||
return false; | ||
} | ||
const { subscribed, alreadySubscribed } = destructSubscribeResponse(response); | ||
return subscribed.includes(channel) || alreadySubscribed.includes(channel); | ||
}; | ||
const destructSubscribeResponse = (response) => { | ||
@@ -280,2 +273,2 @@ const tmp = { | ||
}; | ||
export { getUserMedia, getDevices, scanResolutions, getMediaConstraints, assureDeviceId, removeUnsupportedConstraints, checkDeviceIdConstraints, sdpStereoHack, sdpMediaOrderHack, sdpBitrateHack, checkSubscribeResponse, destructSubscribeResponse, enableAudioTracks, disableAudioTracks, toggleAudioTracks, enableVideoTracks, disableVideoTracks, toggleVideoTracks, mutateCanvasInfoData, }; | ||
export { getUserMedia, getDevices, scanResolutions, getMediaConstraints, assureDeviceId, removeUnsupportedConstraints, checkDeviceIdConstraints, sdpStereoHack, sdpMediaOrderHack, sdpBitrateHack, destructSubscribeResponse, enableAudioTracks, disableAudioTracks, toggleAudioTracks, enableVideoTracks, disableVideoTracks, toggleVideoTracks, mutateCanvasInfoData, }; |
@@ -97,2 +97,4 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
try { | ||
this.instance.removeEventListener('icecandidate', this._onIce); | ||
this.instance.addEventListener('icecandidate', this._onIce); | ||
if (this.isOffer) { | ||
@@ -138,3 +140,2 @@ logger.info('Trying to generate offer'); | ||
}; | ||
this.instance.addEventListener('icecandidate', this._onIce); | ||
this.instance.addEventListener('track', (event) => { | ||
@@ -141,0 +142,0 @@ this.options.remoteStream = event.streams[0]; |
@@ -22,3 +22,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
if (!callID || !session.calls[callID]) { | ||
return logger.warn('Verto pvtData with invalid or unknown callID.'); | ||
return logger.debug('Verto pvtData with invalid or unknown callID.', pvtData); | ||
} | ||
@@ -87,5 +87,8 @@ switch (action) { | ||
trigger(callID, params, method); | ||
const msg = new Result(id, method); | ||
msg.targetNodeId = nodeId; | ||
return session.execute(msg); | ||
if (method !== VertoMethod.Attach) { | ||
const msg = new Result(id, method); | ||
msg.targetNodeId = nodeId; | ||
session.execute(msg); | ||
} | ||
return; | ||
} | ||
@@ -95,3 +98,3 @@ const attach = method === VertoMethod.Attach; | ||
case VertoMethod.Punt: | ||
return session.disconnect(); | ||
return session.purge(); | ||
case VertoMethod.Invite: { | ||
@@ -113,3 +116,3 @@ const call = _buildCall(session, params, attach, nodeId); | ||
} | ||
logger.warn('Unhandled verto event:', msg); | ||
logger.debug('Unhandled verto event:', msg); | ||
break; | ||
@@ -116,0 +119,0 @@ case VertoMethod.Info: |
@@ -193,3 +193,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
case State.Purge: | ||
this._hangup({ cause: 'PURGE', code: '01' }); | ||
if (this.screenShare instanceof WebRTCCall) { | ||
this.screenShare.setState(State.Purge); | ||
} | ||
if (this.secondSource instanceof WebRTCCall) { | ||
this.secondSource.setState(State.Purge); | ||
} | ||
this._finalize(); | ||
break; | ||
@@ -215,8 +221,3 @@ case State.Active: { | ||
case State.Destroy: | ||
if (this.conference instanceof Conference) { | ||
this.conference.destroy().then(() => this._finalize()); | ||
} | ||
else { | ||
this._finalize(); | ||
} | ||
this._finalize(); | ||
break; | ||
@@ -366,3 +367,5 @@ } | ||
} | ||
delete this.conference; | ||
if (this.conference instanceof Conference) { | ||
this.conference.destroy().then(() => delete this.conference); | ||
} | ||
const { remoteStream, localStream, remoteElement, localElement } = this.options; | ||
@@ -369,0 +372,0 @@ stopStream(remoteStream); |
import Relay from './src/SignalWire'; | ||
import Verto from './src/Verto'; | ||
import CantinaAuth from '../common/src/webrtc/CantinaAuth'; | ||
export declare const VERSION = "1.3.0-alpha.6"; | ||
export declare const VERSION = "1.3.0-alpha.7"; | ||
export { Relay, Verto, CantinaAuth }; | ||
export * from '../common/src/util/interfaces'; | ||
export * from '../common/src/webrtc/interfaces'; |
@@ -5,4 +5,4 @@ import Relay from './src/SignalWire'; | ||
import CantinaAuth from '../common/src/webrtc/CantinaAuth'; | ||
export const VERSION = '1.3.0-alpha.6'; | ||
export const VERSION = '1.3.0-alpha.7'; | ||
setAgentName(`JavaScript SDK/${VERSION}`); | ||
export { Relay, Verto, CantinaAuth }; |
{ | ||
"name": "@signalwire/js", | ||
"version": "1.3.0-alpha.6", | ||
"version": "1.3.0-alpha.7", | ||
"description": "Relay SDK for JavaScript to connect to SignalWire.", | ||
@@ -21,3 +21,3 @@ "author": "SignalWire Team <open.source@signalwire.com>", | ||
"tslint": "tslint -p tsconfig.json", | ||
"test": "jest --forceExit --detectOpenHandles", | ||
"test": "jest --no-cache --forceExit --detectOpenHandles", | ||
"test:watch": "npm run test -- --watchAll", | ||
@@ -24,0 +24,0 @@ "validate": "npm i && npm run tslint && npm run test && npm run clean-build", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
301354
4284