@fishjam-cloud/js-server-sdk 0.17.1 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  __require,
4
4
  __toESM,
5
5
  import_fishjam_proto
6
- } from "./chunk-LJUM3R33.mjs";
6
+ } from "./chunk-WRNPFCX3.mjs";
7
7
 
8
8
  // ../fishjam-openapi/dist/index.js
9
9
  var require_dist = __commonJS({
@@ -10781,12 +10781,16 @@ var require_dist = __commonJS({
10781
10781
  RoomApiAxiosParamCreator: () => RoomApiAxiosParamCreator,
10782
10782
  RoomApiFactory: () => RoomApiFactory,
10783
10783
  RoomApiFp: () => RoomApiFp,
10784
- RoomConfigRoomTypeEnum: () => RoomConfigRoomTypeEnum3,
10784
+ RoomConfigRoomTypeEnum: () => RoomConfigRoomTypeEnum2,
10785
10785
  RoomConfigVideoCodecEnum: () => RoomConfigVideoCodecEnum2,
10786
10786
  SipApi: () => SipApi,
10787
10787
  SipApiAxiosParamCreator: () => SipApiAxiosParamCreator,
10788
10788
  SipApiFactory: () => SipApiFactory,
10789
10789
  SipApiFp: () => SipApiFp,
10790
+ StreamerApi: () => StreamerApi2,
10791
+ StreamerApiAxiosParamCreator: () => StreamerApiAxiosParamCreator,
10792
+ StreamerApiFactory: () => StreamerApiFactory,
10793
+ StreamerApiFp: () => StreamerApiFp,
10790
10794
  TrackTypeEnum: () => TrackTypeEnum,
10791
10795
  UserApi: () => UserApi,
10792
10796
  UserApiAxiosParamCreator: () => UserApiAxiosParamCreator,
@@ -14059,10 +14063,12 @@ var require_dist = __commonJS({
14059
14063
  Connected: "connected",
14060
14064
  Disconnected: "disconnected"
14061
14065
  };
14062
- var RoomConfigRoomTypeEnum3 = {
14066
+ var RoomConfigRoomTypeEnum2 = {
14063
14067
  FullFeature: "full_feature",
14064
14068
  AudioOnly: "audio_only",
14065
- Broadcaster: "broadcaster"
14069
+ Broadcaster: "broadcaster",
14070
+ Livestream: "livestream",
14071
+ Conference: "conference"
14066
14072
  };
14067
14073
  var RoomConfigVideoCodecEnum2 = {
14068
14074
  H264: "h264",
@@ -14175,6 +14181,30 @@ var require_dist = __commonJS({
14175
14181
  options: localVarRequestOptions
14176
14182
  };
14177
14183
  },
14184
+ /**
14185
+ *
14186
+ * @summary Handle notification from broadcaster
14187
+ * @param {*} [options] Override http request option.
14188
+ * @throws {RequiredError}
14189
+ */
14190
+ notification: async (options = {}) => {
14191
+ const localVarPath = `/notifications`;
14192
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
14193
+ let baseOptions;
14194
+ if (configuration) {
14195
+ baseOptions = configuration.baseOptions;
14196
+ }
14197
+ const localVarRequestOptions = { method: "POST", ...baseOptions, ...options };
14198
+ const localVarHeaderParameter = {};
14199
+ const localVarQueryParameter = {};
14200
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
14201
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
14202
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
14203
+ return {
14204
+ url: toPathString(localVarUrlObj),
14205
+ options: localVarRequestOptions
14206
+ };
14207
+ },
14178
14208
  /**
14179
14209
  *
14180
14210
  * @summary Returns status information for the shutdown process of Fishjam.
@@ -14217,6 +14247,18 @@ var require_dist = __commonJS({
14217
14247
  const localVarOperationServerBasePath = operationServerMap["DefaultApi.drainNode"]?.[localVarOperationServerIndex]?.url;
14218
14248
  return (axios22, basePath) => createRequestFunction(localVarAxiosArgs, axios_default, BASE_PATH, configuration)(axios22, localVarOperationServerBasePath || basePath);
14219
14249
  },
14250
+ /**
14251
+ *
14252
+ * @summary Handle notification from broadcaster
14253
+ * @param {*} [options] Override http request option.
14254
+ * @throws {RequiredError}
14255
+ */
14256
+ async notification(options) {
14257
+ const localVarAxiosArgs = await localVarAxiosParamCreator.notification(options);
14258
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
14259
+ const localVarOperationServerBasePath = operationServerMap["DefaultApi.notification"]?.[localVarOperationServerIndex]?.url;
14260
+ return (axios22, basePath) => createRequestFunction(localVarAxiosArgs, axios_default, BASE_PATH, configuration)(axios22, localVarOperationServerBasePath || basePath);
14261
+ },
14220
14262
  /**
14221
14263
  *
14222
14264
  * @summary Returns status information for the shutdown process of Fishjam.
@@ -14243,6 +14285,15 @@ var require_dist = __commonJS({
14243
14285
  drainNode(options) {
14244
14286
  return localVarFp.drainNode(options).then((request) => request(axios22, basePath));
14245
14287
  },
14288
+ /**
14289
+ *
14290
+ * @summary Handle notification from broadcaster
14291
+ * @param {*} [options] Override http request option.
14292
+ * @throws {RequiredError}
14293
+ */
14294
+ notification(options) {
14295
+ return localVarFp.notification(options).then((request) => request(axios22, basePath));
14296
+ },
14246
14297
  /**
14247
14298
  *
14248
14299
  * @summary Returns status information for the shutdown process of Fishjam.
@@ -14265,6 +14316,16 @@ var require_dist = __commonJS({
14265
14316
  drainNode(options) {
14266
14317
  return DefaultApiFp(this.configuration).drainNode(options).then((request) => request(this.axios, this.basePath));
14267
14318
  }
14319
+ /**
14320
+ *
14321
+ * @summary Handle notification from broadcaster
14322
+ * @param {*} [options] Override http request option.
14323
+ * @throws {RequiredError}
14324
+ * @memberof DefaultApi
14325
+ */
14326
+ notification(options) {
14327
+ return DefaultApiFp(this.configuration).notification(options).then((request) => request(this.axios, this.basePath));
14328
+ }
14268
14329
  /**
14269
14330
  *
14270
14331
  * @summary Returns status information for the shutdown process of Fishjam.
@@ -15469,6 +15530,82 @@ var require_dist = __commonJS({
15469
15530
  return SipApiFp(this.configuration).endCall(roomId, componentId, options).then((request) => request(this.axios, this.basePath));
15470
15531
  }
15471
15532
  };
15533
+ var StreamerApiAxiosParamCreator = function(configuration) {
15534
+ return {
15535
+ /**
15536
+ *
15537
+ * @summary Generate a token that can be used by a streamer to start streaming
15538
+ * @param {string} roomId ID of the stream.
15539
+ * @param {*} [options] Override http request option.
15540
+ * @throws {RequiredError}
15541
+ */
15542
+ generateStreamerToken: async (roomId, options = {}) => {
15543
+ assertParamExists("generateStreamerToken", "roomId", roomId);
15544
+ const localVarPath = `/room/{room_id}/streamer`.replace(`{${"room_id"}}`, encodeURIComponent(String(roomId)));
15545
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
15546
+ let baseOptions;
15547
+ if (configuration) {
15548
+ baseOptions = configuration.baseOptions;
15549
+ }
15550
+ const localVarRequestOptions = { method: "POST", ...baseOptions, ...options };
15551
+ const localVarHeaderParameter = {};
15552
+ const localVarQueryParameter = {};
15553
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
15554
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
15555
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
15556
+ return {
15557
+ url: toPathString(localVarUrlObj),
15558
+ options: localVarRequestOptions
15559
+ };
15560
+ }
15561
+ };
15562
+ };
15563
+ var StreamerApiFp = function(configuration) {
15564
+ const localVarAxiosParamCreator = StreamerApiAxiosParamCreator(configuration);
15565
+ return {
15566
+ /**
15567
+ *
15568
+ * @summary Generate a token that can be used by a streamer to start streaming
15569
+ * @param {string} roomId ID of the stream.
15570
+ * @param {*} [options] Override http request option.
15571
+ * @throws {RequiredError}
15572
+ */
15573
+ async generateStreamerToken(roomId, options) {
15574
+ const localVarAxiosArgs = await localVarAxiosParamCreator.generateStreamerToken(roomId, options);
15575
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
15576
+ const localVarOperationServerBasePath = operationServerMap["StreamerApi.generateStreamerToken"]?.[localVarOperationServerIndex]?.url;
15577
+ return (axios22, basePath) => createRequestFunction(localVarAxiosArgs, axios_default, BASE_PATH, configuration)(axios22, localVarOperationServerBasePath || basePath);
15578
+ }
15579
+ };
15580
+ };
15581
+ var StreamerApiFactory = function(configuration, basePath, axios22) {
15582
+ const localVarFp = StreamerApiFp(configuration);
15583
+ return {
15584
+ /**
15585
+ *
15586
+ * @summary Generate a token that can be used by a streamer to start streaming
15587
+ * @param {string} roomId ID of the stream.
15588
+ * @param {*} [options] Override http request option.
15589
+ * @throws {RequiredError}
15590
+ */
15591
+ generateStreamerToken(roomId, options) {
15592
+ return localVarFp.generateStreamerToken(roomId, options).then((request) => request(axios22, basePath));
15593
+ }
15594
+ };
15595
+ };
15596
+ var StreamerApi2 = class extends BaseAPI {
15597
+ /**
15598
+ *
15599
+ * @summary Generate a token that can be used by a streamer to start streaming
15600
+ * @param {string} roomId ID of the stream.
15601
+ * @param {*} [options] Override http request option.
15602
+ * @throws {RequiredError}
15603
+ * @memberof StreamerApi
15604
+ */
15605
+ generateStreamerToken(roomId, options) {
15606
+ return StreamerApiFp(this.configuration).generateStreamerToken(roomId, options).then((request) => request(this.axios, this.basePath));
15607
+ }
15608
+ };
15472
15609
  var UserApiAxiosParamCreator = function(configuration) {
15473
15610
  return {
15474
15611
  /**
@@ -15672,13 +15809,13 @@ var require_dist = __commonJS({
15672
15809
  return {
15673
15810
  /**
15674
15811
  *
15675
- * @summary Generate single broadcaster access token
15676
- * @param {string} roomId A room id.
15812
+ * @summary Generates token that a viewer can use to watch a livestream
15813
+ * @param {string} roomId ID of the stream.
15677
15814
  * @param {*} [options] Override http request option.
15678
15815
  * @throws {RequiredError}
15679
15816
  */
15680
- generateToken: async (roomId, options = {}) => {
15681
- assertParamExists("generateToken", "roomId", roomId);
15817
+ generateViewerToken: async (roomId, options = {}) => {
15818
+ assertParamExists("generateViewerToken", "roomId", roomId);
15682
15819
  const localVarPath = `/room/{room_id}/viewer`.replace(`{${"room_id"}}`, encodeURIComponent(String(roomId)));
15683
15820
  const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
15684
15821
  let baseOptions;
@@ -15703,15 +15840,15 @@ var require_dist = __commonJS({
15703
15840
  return {
15704
15841
  /**
15705
15842
  *
15706
- * @summary Generate single broadcaster access token
15707
- * @param {string} roomId A room id.
15843
+ * @summary Generates token that a viewer can use to watch a livestream
15844
+ * @param {string} roomId ID of the stream.
15708
15845
  * @param {*} [options] Override http request option.
15709
15846
  * @throws {RequiredError}
15710
15847
  */
15711
- async generateToken(roomId, options) {
15712
- const localVarAxiosArgs = await localVarAxiosParamCreator.generateToken(roomId, options);
15848
+ async generateViewerToken(roomId, options) {
15849
+ const localVarAxiosArgs = await localVarAxiosParamCreator.generateViewerToken(roomId, options);
15713
15850
  const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
15714
- const localVarOperationServerBasePath = operationServerMap["ViewerApi.generateToken"]?.[localVarOperationServerIndex]?.url;
15851
+ const localVarOperationServerBasePath = operationServerMap["ViewerApi.generateViewerToken"]?.[localVarOperationServerIndex]?.url;
15715
15852
  return (axios22, basePath) => createRequestFunction(localVarAxiosArgs, axios_default, BASE_PATH, configuration)(axios22, localVarOperationServerBasePath || basePath);
15716
15853
  }
15717
15854
  };
@@ -15721,27 +15858,27 @@ var require_dist = __commonJS({
15721
15858
  return {
15722
15859
  /**
15723
15860
  *
15724
- * @summary Generate single broadcaster access token
15725
- * @param {string} roomId A room id.
15861
+ * @summary Generates token that a viewer can use to watch a livestream
15862
+ * @param {string} roomId ID of the stream.
15726
15863
  * @param {*} [options] Override http request option.
15727
15864
  * @throws {RequiredError}
15728
15865
  */
15729
- generateToken(roomId, options) {
15730
- return localVarFp.generateToken(roomId, options).then((request) => request(axios22, basePath));
15866
+ generateViewerToken(roomId, options) {
15867
+ return localVarFp.generateViewerToken(roomId, options).then((request) => request(axios22, basePath));
15731
15868
  }
15732
15869
  };
15733
15870
  };
15734
15871
  var ViewerApi2 = class extends BaseAPI {
15735
15872
  /**
15736
15873
  *
15737
- * @summary Generate single broadcaster access token
15738
- * @param {string} roomId A room id.
15874
+ * @summary Generates token that a viewer can use to watch a livestream
15875
+ * @param {string} roomId ID of the stream.
15739
15876
  * @param {*} [options] Override http request option.
15740
15877
  * @throws {RequiredError}
15741
15878
  * @memberof ViewerApi
15742
15879
  */
15743
- generateToken(roomId, options) {
15744
- return ViewerApiFp(this.configuration).generateToken(roomId, options).then((request) => request(this.axios, this.basePath));
15880
+ generateViewerToken(roomId, options) {
15881
+ return ViewerApiFp(this.configuration).generateViewerToken(roomId, options).then((request) => request(this.axios, this.basePath));
15745
15882
  }
15746
15883
  };
15747
15884
  var Configuration = class {
@@ -15836,12 +15973,50 @@ var import_fishjam_openapi2 = __toESM(require_dist());
15836
15973
  import * as WebSocket from "websocket";
15837
15974
  import { EventEmitter } from "events";
15838
15975
 
15839
- // src/utlis.ts
15976
+ // src/exceptions/index.ts
15977
+ var MissingFishjamIdException = class extends Error {
15978
+ constructor() {
15979
+ super("Fishjam ID is required");
15980
+ }
15981
+ };
15982
+ var FishjamBaseException = class extends Error {
15983
+ statusCode;
15984
+ axiosCode;
15985
+ details;
15986
+ constructor(error) {
15987
+ super(error.message);
15988
+ this.statusCode = error.response?.status ?? 500;
15989
+ this.axiosCode = error.code;
15990
+ this.details = error.response?.data["detail"] ?? error.response?.data["errors"] ?? "Unknown error";
15991
+ }
15992
+ };
15993
+ var BadRequestException = class extends FishjamBaseException {
15994
+ };
15995
+ var UnauthorizedException = class extends FishjamBaseException {
15996
+ };
15997
+ var ForbiddenException = class extends FishjamBaseException {
15998
+ };
15999
+ var RoomNotFoundException = class extends FishjamBaseException {
16000
+ };
16001
+ var FishjamNotFoundException = class extends FishjamBaseException {
16002
+ };
16003
+ var PeerNotFoundException = class extends FishjamBaseException {
16004
+ };
16005
+ var ServiceUnavailableException = class extends FishjamBaseException {
16006
+ };
16007
+ var UnknownException = class extends FishjamBaseException {
16008
+ };
16009
+
16010
+ // src/utils.ts
15840
16011
  var httpToWebsocket = (httpUrl) => {
15841
16012
  const url = new URL(httpUrl);
15842
16013
  url.protocol = url.protocol.replace("http", "ws");
15843
16014
  return url.href;
15844
16015
  };
16016
+ var getFishjamUrl = (config) => {
16017
+ if (!config.fishjamId && !config.fishjamUrl) throw new MissingFishjamIdException();
16018
+ return config.fishjamUrl ?? `https://fishjam.io/api/v1/connect/${config.fishjamId}`;
16019
+ };
15845
16020
 
15846
16021
  // src/ws_notifier.ts
15847
16022
  var expectedEventsList = [
@@ -15863,13 +16038,14 @@ var FishjamWSNotifier = class extends EventEmitter {
15863
16038
  constructor(config, onError, onClose, onConnectionFailed) {
15864
16039
  super();
15865
16040
  this.client = new WebSocket.client();
15866
- const fishjamUrl = `${httpToWebsocket(config.fishjamUrl)}/socket/server/websocket`;
16041
+ const fishjamUrl = getFishjamUrl(config);
16042
+ const websocketUrl = `${httpToWebsocket(fishjamUrl)}/socket/server/websocket`;
15867
16043
  this.client.on("connectFailed", (message) => onConnectionFailed(message));
15868
16044
  this.client.on(
15869
16045
  "connect",
15870
16046
  (connection) => this.setupConnection(connection, config.managementToken, onError, onClose)
15871
16047
  );
15872
- this.client.connect(fishjamUrl);
16048
+ this.client.connect(websocketUrl);
15873
16049
  }
15874
16050
  dispatchNotification(message) {
15875
16051
  if (message.type == "utf8") {
@@ -15907,35 +16083,6 @@ var FishjamWSNotifier = class extends EventEmitter {
15907
16083
  var import_fishjam_openapi = __toESM(require_dist());
15908
16084
  import axios from "axios";
15909
16085
 
15910
- // src/exceptions/index.ts
15911
- var FishjamBaseException = class extends Error {
15912
- statusCode;
15913
- axiosCode;
15914
- details;
15915
- constructor(error) {
15916
- super(error.message);
15917
- this.statusCode = error.response?.status ?? 500;
15918
- this.axiosCode = error.code;
15919
- this.details = error.response?.data["detail"] ?? error.response?.data["errors"] ?? "Unknown error";
15920
- }
15921
- };
15922
- var BadRequestException = class extends FishjamBaseException {
15923
- };
15924
- var UnauthorizedException = class extends FishjamBaseException {
15925
- };
15926
- var ForbiddenException = class extends FishjamBaseException {
15927
- };
15928
- var RoomNotFoundException = class extends FishjamBaseException {
15929
- };
15930
- var FishjamNotFoundException = class extends FishjamBaseException {
15931
- };
15932
- var PeerNotFoundException = class extends FishjamBaseException {
15933
- };
15934
- var ServiceUnavailableException = class extends FishjamBaseException {
15935
- };
15936
- var UnknownException = class extends FishjamBaseException {
15937
- };
15938
-
15939
16086
  // src/exceptions/mapper.ts
15940
16087
  function isAxiosException(error) {
15941
16088
  return !!error && typeof error === "object" && "isAxiosError" in error && !!error.isAxiosError;
@@ -15970,6 +16117,7 @@ var mapException = (error, entity) => {
15970
16117
  var FishjamClient = class {
15971
16118
  roomApi;
15972
16119
  viewerApi;
16120
+ streamerApi;
15973
16121
  /**
15974
16122
  * Create new instance of Fishjam Client.
15975
16123
  *
@@ -15987,16 +16135,17 @@ var FishjamClient = class {
15987
16135
  Authorization: `Bearer ${config.managementToken}`
15988
16136
  }
15989
16137
  });
15990
- this.roomApi = new import_fishjam_openapi.RoomApi(void 0, config.fishjamUrl, client2);
15991
- this.viewerApi = new import_fishjam_openapi.ViewerApi(void 0, config.fishjamUrl, client2);
16138
+ const fishjamUrl = getFishjamUrl(config);
16139
+ this.roomApi = new import_fishjam_openapi.RoomApi(void 0, fishjamUrl, client2);
16140
+ this.viewerApi = new import_fishjam_openapi.ViewerApi(void 0, fishjamUrl, client2);
16141
+ this.streamerApi = new import_fishjam_openapi.StreamerApi(void 0, fishjamUrl, client2);
15992
16142
  }
15993
16143
  /**
15994
16144
  * Create a new room. All peers connected to the same room will be able to send/receive streams to each other.
15995
16145
  */
15996
16146
  async createRoom(config = {}) {
15997
16147
  try {
15998
- const parsedRoomType = config.roomType == "livestream" ? import_fishjam_openapi.RoomConfigRoomTypeEnum.Broadcaster : config.roomType;
15999
- const response = await this.roomApi.createRoom({ ...config, roomType: parsedRoomType });
16148
+ const response = await this.roomApi.createRoom(config);
16000
16149
  const {
16001
16150
  data: {
16002
16151
  data: {
@@ -16088,7 +16237,19 @@ var FishjamClient = class {
16088
16237
  */
16089
16238
  async createLivestreamViewerToken(roomId) {
16090
16239
  try {
16091
- const tokenResponse = await this.viewerApi.generateToken(roomId);
16240
+ const tokenResponse = await this.viewerApi.generateViewerToken(roomId);
16241
+ return tokenResponse.data;
16242
+ } catch (error) {
16243
+ throw mapException(error);
16244
+ }
16245
+ }
16246
+ /**
16247
+ * Creates a livestream streamer token for the given room.
16248
+ * @returns a livestream streamer token
16249
+ */
16250
+ async createLivestreamStreamerToken(roomId) {
16251
+ try {
16252
+ const tokenResponse = await this.streamerApi.generateStreamerToken(roomId);
16092
16253
  return tokenResponse.data;
16093
16254
  } catch (error) {
16094
16255
  throw mapException(error);
@@ -16100,6 +16261,7 @@ var export_PeerStatus = import_fishjam_openapi2.PeerStatus;
16100
16261
  var export_RoomConfig = import_fishjam_openapi2.RoomConfig;
16101
16262
  var export_RoomConfigRoomTypeEnum = import_fishjam_openapi2.RoomConfigRoomTypeEnum;
16102
16263
  var export_RoomConfigVideoCodecEnum = import_fishjam_openapi2.RoomConfigVideoCodecEnum;
16264
+ var export_StreamerToken = import_fishjam_openapi2.StreamerToken;
16103
16265
  var export_ViewerToken = import_fishjam_openapi2.ViewerToken;
16104
16266
  export {
16105
16267
  BadRequestException,
@@ -16108,6 +16270,7 @@ export {
16108
16270
  FishjamNotFoundException,
16109
16271
  FishjamWSNotifier,
16110
16272
  ForbiddenException,
16273
+ MissingFishjamIdException,
16111
16274
  PeerNotFoundException,
16112
16275
  export_PeerOptions as PeerOptions,
16113
16276
  export_PeerStatus as PeerStatus,
@@ -16116,6 +16279,7 @@ export {
16116
16279
  export_RoomConfigVideoCodecEnum as RoomConfigVideoCodecEnum,
16117
16280
  RoomNotFoundException,
16118
16281
  ServiceUnavailableException,
16282
+ export_StreamerToken as StreamerToken,
16119
16283
  UnauthorizedException,
16120
16284
  UnknownException,
16121
16285
  export_ViewerToken as ViewerToken
package/dist/proto.d.mts CHANGED
@@ -1,10 +1,9 @@
1
1
  import { BinaryWriter, BinaryReader } from '@bufbuild/protobuf/wire';
2
2
 
3
- /** Defines message groups for which client can subscribe */
3
+ /** Defines message groups for which peer can subscribe */
4
4
  declare enum ServerMessage_EventType {
5
5
  EVENT_TYPE_UNSPECIFIED = 0,
6
6
  EVENT_TYPE_SERVER_NOTIFICATION = 1,
7
- EVENT_TYPE_METRICS = 2,
8
7
  UNRECOGNIZED = -1
9
8
  }
10
9
  /** Defines types of tracks being published by peers and component */
@@ -14,7 +13,7 @@ declare enum ServerMessage_TrackType {
14
13
  TRACK_TYPE_AUDIO = 2,
15
14
  UNRECOGNIZED = -1
16
15
  }
17
- /** Defines any type of message passed between FJ and server client */
16
+ /** Defines any type of message passed between FJ and server peer */
18
17
  interface ServerMessage {
19
18
  roomCrashed?: ServerMessage_RoomCrashed | undefined;
20
19
  peerConnected?: ServerMessage_PeerConnected | undefined;
@@ -27,7 +26,6 @@ interface ServerMessage {
27
26
  subscribeResponse?: ServerMessage_SubscribeResponse | undefined;
28
27
  roomCreated?: ServerMessage_RoomCreated | undefined;
29
28
  roomDeleted?: ServerMessage_RoomDeleted | undefined;
30
- metricsReport?: ServerMessage_MetricsReport | undefined;
31
29
  hlsPlayable?: ServerMessage_HlsPlayable | undefined;
32
30
  hlsUploaded?: ServerMessage_HlsUploaded | undefined;
33
31
  hlsUploadCrashed?: ServerMessage_HlsUploadCrashed | undefined;
@@ -37,6 +35,10 @@ interface ServerMessage {
37
35
  trackMetadataUpdated?: ServerMessage_TrackMetadataUpdated | undefined;
38
36
  peerAdded?: ServerMessage_PeerAdded | undefined;
39
37
  peerDeleted?: ServerMessage_PeerDeleted | undefined;
38
+ streamConnected?: ServerMessage_StreamConnected | undefined;
39
+ streamDisconnected?: ServerMessage_StreamDisconnected | undefined;
40
+ viewerConnected?: ServerMessage_ViewerConnected | undefined;
41
+ viewerDisconnected?: ServerMessage_ViewerDisconnected | undefined;
40
42
  }
41
43
  declare const ServerMessage: MessageFns<ServerMessage>;
42
44
  /** Notification sent when a room crashes */
@@ -85,12 +87,12 @@ declare const ServerMessage_ComponentCrashed: MessageFns<ServerMessage_Component
85
87
  interface ServerMessage_Authenticated {
86
88
  }
87
89
  declare const ServerMessage_Authenticated: MessageFns<ServerMessage_Authenticated>;
88
- /** Request sent by client, to authenticate to FJ server */
90
+ /** Request sent by peer, to authenticate to FJ server */
89
91
  interface ServerMessage_AuthRequest {
90
92
  token: string;
91
93
  }
92
94
  declare const ServerMessage_AuthRequest: MessageFns<ServerMessage_AuthRequest>;
93
- /** Request sent by client to subsribe for certain message type */
95
+ /** Request sent by peer to subsribe for certain message type */
94
96
  interface ServerMessage_SubscribeRequest {
95
97
  eventType: ServerMessage_EventType;
96
98
  }
@@ -110,11 +112,6 @@ interface ServerMessage_RoomDeleted {
110
112
  roomId: string;
111
113
  }
112
114
  declare const ServerMessage_RoomDeleted: MessageFns<ServerMessage_RoomDeleted>;
113
- /** Message containing WebRTC metrics from FJ */
114
- interface ServerMessage_MetricsReport {
115
- metrics: string;
116
- }
117
- declare const ServerMessage_MetricsReport: MessageFns<ServerMessage_MetricsReport>;
118
115
  /** Notification sent when the HLS stream becomes available in a room */
119
116
  interface ServerMessage_HlsPlayable {
120
117
  roomId: string;
@@ -169,6 +166,28 @@ interface ServerMessage_TrackMetadataUpdated {
169
166
  track: ServerMessage_Track | undefined;
170
167
  }
171
168
  declare const ServerMessage_TrackMetadataUpdated: MessageFns<ServerMessage_TrackMetadataUpdated>;
169
+ /** Notification sent when streamer successfully connects */
170
+ interface ServerMessage_StreamConnected {
171
+ streamId: string;
172
+ }
173
+ declare const ServerMessage_StreamConnected: MessageFns<ServerMessage_StreamConnected>;
174
+ /** Notification sent when streamer disconnects */
175
+ interface ServerMessage_StreamDisconnected {
176
+ streamId: string;
177
+ }
178
+ declare const ServerMessage_StreamDisconnected: MessageFns<ServerMessage_StreamDisconnected>;
179
+ /** Notification sent when viewer successfully connects */
180
+ interface ServerMessage_ViewerConnected {
181
+ streamId: string;
182
+ viewerId: string;
183
+ }
184
+ declare const ServerMessage_ViewerConnected: MessageFns<ServerMessage_ViewerConnected>;
185
+ /** Notification sent when viewer disconnects */
186
+ interface ServerMessage_ViewerDisconnected {
187
+ streamId: string;
188
+ viewerId: string;
189
+ }
190
+ declare const ServerMessage_ViewerDisconnected: MessageFns<ServerMessage_ViewerDisconnected>;
172
191
  type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
173
192
  type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
174
193
  [K in keyof T]?: DeepPartial<T[K]>;
package/dist/proto.d.ts CHANGED
@@ -1,10 +1,9 @@
1
1
  import { BinaryWriter, BinaryReader } from '@bufbuild/protobuf/wire';
2
2
 
3
- /** Defines message groups for which client can subscribe */
3
+ /** Defines message groups for which peer can subscribe */
4
4
  declare enum ServerMessage_EventType {
5
5
  EVENT_TYPE_UNSPECIFIED = 0,
6
6
  EVENT_TYPE_SERVER_NOTIFICATION = 1,
7
- EVENT_TYPE_METRICS = 2,
8
7
  UNRECOGNIZED = -1
9
8
  }
10
9
  /** Defines types of tracks being published by peers and component */
@@ -14,7 +13,7 @@ declare enum ServerMessage_TrackType {
14
13
  TRACK_TYPE_AUDIO = 2,
15
14
  UNRECOGNIZED = -1
16
15
  }
17
- /** Defines any type of message passed between FJ and server client */
16
+ /** Defines any type of message passed between FJ and server peer */
18
17
  interface ServerMessage {
19
18
  roomCrashed?: ServerMessage_RoomCrashed | undefined;
20
19
  peerConnected?: ServerMessage_PeerConnected | undefined;
@@ -27,7 +26,6 @@ interface ServerMessage {
27
26
  subscribeResponse?: ServerMessage_SubscribeResponse | undefined;
28
27
  roomCreated?: ServerMessage_RoomCreated | undefined;
29
28
  roomDeleted?: ServerMessage_RoomDeleted | undefined;
30
- metricsReport?: ServerMessage_MetricsReport | undefined;
31
29
  hlsPlayable?: ServerMessage_HlsPlayable | undefined;
32
30
  hlsUploaded?: ServerMessage_HlsUploaded | undefined;
33
31
  hlsUploadCrashed?: ServerMessage_HlsUploadCrashed | undefined;
@@ -37,6 +35,10 @@ interface ServerMessage {
37
35
  trackMetadataUpdated?: ServerMessage_TrackMetadataUpdated | undefined;
38
36
  peerAdded?: ServerMessage_PeerAdded | undefined;
39
37
  peerDeleted?: ServerMessage_PeerDeleted | undefined;
38
+ streamConnected?: ServerMessage_StreamConnected | undefined;
39
+ streamDisconnected?: ServerMessage_StreamDisconnected | undefined;
40
+ viewerConnected?: ServerMessage_ViewerConnected | undefined;
41
+ viewerDisconnected?: ServerMessage_ViewerDisconnected | undefined;
40
42
  }
41
43
  declare const ServerMessage: MessageFns<ServerMessage>;
42
44
  /** Notification sent when a room crashes */
@@ -85,12 +87,12 @@ declare const ServerMessage_ComponentCrashed: MessageFns<ServerMessage_Component
85
87
  interface ServerMessage_Authenticated {
86
88
  }
87
89
  declare const ServerMessage_Authenticated: MessageFns<ServerMessage_Authenticated>;
88
- /** Request sent by client, to authenticate to FJ server */
90
+ /** Request sent by peer, to authenticate to FJ server */
89
91
  interface ServerMessage_AuthRequest {
90
92
  token: string;
91
93
  }
92
94
  declare const ServerMessage_AuthRequest: MessageFns<ServerMessage_AuthRequest>;
93
- /** Request sent by client to subsribe for certain message type */
95
+ /** Request sent by peer to subsribe for certain message type */
94
96
  interface ServerMessage_SubscribeRequest {
95
97
  eventType: ServerMessage_EventType;
96
98
  }
@@ -110,11 +112,6 @@ interface ServerMessage_RoomDeleted {
110
112
  roomId: string;
111
113
  }
112
114
  declare const ServerMessage_RoomDeleted: MessageFns<ServerMessage_RoomDeleted>;
113
- /** Message containing WebRTC metrics from FJ */
114
- interface ServerMessage_MetricsReport {
115
- metrics: string;
116
- }
117
- declare const ServerMessage_MetricsReport: MessageFns<ServerMessage_MetricsReport>;
118
115
  /** Notification sent when the HLS stream becomes available in a room */
119
116
  interface ServerMessage_HlsPlayable {
120
117
  roomId: string;
@@ -169,6 +166,28 @@ interface ServerMessage_TrackMetadataUpdated {
169
166
  track: ServerMessage_Track | undefined;
170
167
  }
171
168
  declare const ServerMessage_TrackMetadataUpdated: MessageFns<ServerMessage_TrackMetadataUpdated>;
169
+ /** Notification sent when streamer successfully connects */
170
+ interface ServerMessage_StreamConnected {
171
+ streamId: string;
172
+ }
173
+ declare const ServerMessage_StreamConnected: MessageFns<ServerMessage_StreamConnected>;
174
+ /** Notification sent when streamer disconnects */
175
+ interface ServerMessage_StreamDisconnected {
176
+ streamId: string;
177
+ }
178
+ declare const ServerMessage_StreamDisconnected: MessageFns<ServerMessage_StreamDisconnected>;
179
+ /** Notification sent when viewer successfully connects */
180
+ interface ServerMessage_ViewerConnected {
181
+ streamId: string;
182
+ viewerId: string;
183
+ }
184
+ declare const ServerMessage_ViewerConnected: MessageFns<ServerMessage_ViewerConnected>;
185
+ /** Notification sent when viewer disconnects */
186
+ interface ServerMessage_ViewerDisconnected {
187
+ streamId: string;
188
+ viewerId: string;
189
+ }
190
+ declare const ServerMessage_ViewerDisconnected: MessageFns<ServerMessage_ViewerDisconnected>;
172
191
  type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
173
192
  type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
174
193
  [K in keyof T]?: DeepPartial<T[K]>;