@fishjam-cloud/js-server-sdk 0.19.0 → 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({
@@ -10787,6 +10787,10 @@ var require_dist = __commonJS({
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,
@@ -14177,6 +14181,30 @@ var require_dist = __commonJS({
14177
14181
  options: localVarRequestOptions
14178
14182
  };
14179
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
+ },
14180
14208
  /**
14181
14209
  *
14182
14210
  * @summary Returns status information for the shutdown process of Fishjam.
@@ -14219,6 +14247,18 @@ var require_dist = __commonJS({
14219
14247
  const localVarOperationServerBasePath = operationServerMap["DefaultApi.drainNode"]?.[localVarOperationServerIndex]?.url;
14220
14248
  return (axios22, basePath) => createRequestFunction(localVarAxiosArgs, axios_default, BASE_PATH, configuration)(axios22, localVarOperationServerBasePath || basePath);
14221
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
+ },
14222
14262
  /**
14223
14263
  *
14224
14264
  * @summary Returns status information for the shutdown process of Fishjam.
@@ -14245,6 +14285,15 @@ var require_dist = __commonJS({
14245
14285
  drainNode(options) {
14246
14286
  return localVarFp.drainNode(options).then((request) => request(axios22, basePath));
14247
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
+ },
14248
14297
  /**
14249
14298
  *
14250
14299
  * @summary Returns status information for the shutdown process of Fishjam.
@@ -14267,6 +14316,16 @@ var require_dist = __commonJS({
14267
14316
  drainNode(options) {
14268
14317
  return DefaultApiFp(this.configuration).drainNode(options).then((request) => request(this.axios, this.basePath));
14269
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
+ }
14270
14329
  /**
14271
14330
  *
14272
14331
  * @summary Returns status information for the shutdown process of Fishjam.
@@ -15471,6 +15530,82 @@ var require_dist = __commonJS({
15471
15530
  return SipApiFp(this.configuration).endCall(roomId, componentId, options).then((request) => request(this.axios, this.basePath));
15472
15531
  }
15473
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
+ };
15474
15609
  var UserApiAxiosParamCreator = function(configuration) {
15475
15610
  return {
15476
15611
  /**
@@ -15674,13 +15809,13 @@ var require_dist = __commonJS({
15674
15809
  return {
15675
15810
  /**
15676
15811
  *
15677
- * @summary Generate single livestream access token
15678
- * @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.
15679
15814
  * @param {*} [options] Override http request option.
15680
15815
  * @throws {RequiredError}
15681
15816
  */
15682
- generateToken: async (roomId, options = {}) => {
15683
- assertParamExists("generateToken", "roomId", roomId);
15817
+ generateViewerToken: async (roomId, options = {}) => {
15818
+ assertParamExists("generateViewerToken", "roomId", roomId);
15684
15819
  const localVarPath = `/room/{room_id}/viewer`.replace(`{${"room_id"}}`, encodeURIComponent(String(roomId)));
15685
15820
  const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
15686
15821
  let baseOptions;
@@ -15705,15 +15840,15 @@ var require_dist = __commonJS({
15705
15840
  return {
15706
15841
  /**
15707
15842
  *
15708
- * @summary Generate single livestream access token
15709
- * @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.
15710
15845
  * @param {*} [options] Override http request option.
15711
15846
  * @throws {RequiredError}
15712
15847
  */
15713
- async generateToken(roomId, options) {
15714
- const localVarAxiosArgs = await localVarAxiosParamCreator.generateToken(roomId, options);
15848
+ async generateViewerToken(roomId, options) {
15849
+ const localVarAxiosArgs = await localVarAxiosParamCreator.generateViewerToken(roomId, options);
15715
15850
  const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
15716
- const localVarOperationServerBasePath = operationServerMap["ViewerApi.generateToken"]?.[localVarOperationServerIndex]?.url;
15851
+ const localVarOperationServerBasePath = operationServerMap["ViewerApi.generateViewerToken"]?.[localVarOperationServerIndex]?.url;
15717
15852
  return (axios22, basePath) => createRequestFunction(localVarAxiosArgs, axios_default, BASE_PATH, configuration)(axios22, localVarOperationServerBasePath || basePath);
15718
15853
  }
15719
15854
  };
@@ -15723,27 +15858,27 @@ var require_dist = __commonJS({
15723
15858
  return {
15724
15859
  /**
15725
15860
  *
15726
- * @summary Generate single livestream access token
15727
- * @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.
15728
15863
  * @param {*} [options] Override http request option.
15729
15864
  * @throws {RequiredError}
15730
15865
  */
15731
- generateToken(roomId, options) {
15732
- 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));
15733
15868
  }
15734
15869
  };
15735
15870
  };
15736
15871
  var ViewerApi2 = class extends BaseAPI {
15737
15872
  /**
15738
15873
  *
15739
- * @summary Generate single livestream access token
15740
- * @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.
15741
15876
  * @param {*} [options] Override http request option.
15742
15877
  * @throws {RequiredError}
15743
15878
  * @memberof ViewerApi
15744
15879
  */
15745
- generateToken(roomId, options) {
15746
- 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));
15747
15882
  }
15748
15883
  };
15749
15884
  var Configuration = class {
@@ -15838,12 +15973,50 @@ var import_fishjam_openapi2 = __toESM(require_dist());
15838
15973
  import * as WebSocket from "websocket";
15839
15974
  import { EventEmitter } from "events";
15840
15975
 
15841
- // 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
15842
16011
  var httpToWebsocket = (httpUrl) => {
15843
16012
  const url = new URL(httpUrl);
15844
16013
  url.protocol = url.protocol.replace("http", "ws");
15845
16014
  return url.href;
15846
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
+ };
15847
16020
 
15848
16021
  // src/ws_notifier.ts
15849
16022
  var expectedEventsList = [
@@ -15865,13 +16038,14 @@ var FishjamWSNotifier = class extends EventEmitter {
15865
16038
  constructor(config, onError, onClose, onConnectionFailed) {
15866
16039
  super();
15867
16040
  this.client = new WebSocket.client();
15868
- const fishjamUrl = `${httpToWebsocket(config.fishjamUrl)}/socket/server/websocket`;
16041
+ const fishjamUrl = getFishjamUrl(config);
16042
+ const websocketUrl = `${httpToWebsocket(fishjamUrl)}/socket/server/websocket`;
15869
16043
  this.client.on("connectFailed", (message) => onConnectionFailed(message));
15870
16044
  this.client.on(
15871
16045
  "connect",
15872
16046
  (connection) => this.setupConnection(connection, config.managementToken, onError, onClose)
15873
16047
  );
15874
- this.client.connect(fishjamUrl);
16048
+ this.client.connect(websocketUrl);
15875
16049
  }
15876
16050
  dispatchNotification(message) {
15877
16051
  if (message.type == "utf8") {
@@ -15909,35 +16083,6 @@ var FishjamWSNotifier = class extends EventEmitter {
15909
16083
  var import_fishjam_openapi = __toESM(require_dist());
15910
16084
  import axios from "axios";
15911
16085
 
15912
- // src/exceptions/index.ts
15913
- var FishjamBaseException = class extends Error {
15914
- statusCode;
15915
- axiosCode;
15916
- details;
15917
- constructor(error) {
15918
- super(error.message);
15919
- this.statusCode = error.response?.status ?? 500;
15920
- this.axiosCode = error.code;
15921
- this.details = error.response?.data["detail"] ?? error.response?.data["errors"] ?? "Unknown error";
15922
- }
15923
- };
15924
- var BadRequestException = class extends FishjamBaseException {
15925
- };
15926
- var UnauthorizedException = class extends FishjamBaseException {
15927
- };
15928
- var ForbiddenException = class extends FishjamBaseException {
15929
- };
15930
- var RoomNotFoundException = class extends FishjamBaseException {
15931
- };
15932
- var FishjamNotFoundException = class extends FishjamBaseException {
15933
- };
15934
- var PeerNotFoundException = class extends FishjamBaseException {
15935
- };
15936
- var ServiceUnavailableException = class extends FishjamBaseException {
15937
- };
15938
- var UnknownException = class extends FishjamBaseException {
15939
- };
15940
-
15941
16086
  // src/exceptions/mapper.ts
15942
16087
  function isAxiosException(error) {
15943
16088
  return !!error && typeof error === "object" && "isAxiosError" in error && !!error.isAxiosError;
@@ -15972,6 +16117,7 @@ var mapException = (error, entity) => {
15972
16117
  var FishjamClient = class {
15973
16118
  roomApi;
15974
16119
  viewerApi;
16120
+ streamerApi;
15975
16121
  /**
15976
16122
  * Create new instance of Fishjam Client.
15977
16123
  *
@@ -15989,8 +16135,10 @@ var FishjamClient = class {
15989
16135
  Authorization: `Bearer ${config.managementToken}`
15990
16136
  }
15991
16137
  });
15992
- this.roomApi = new import_fishjam_openapi.RoomApi(void 0, config.fishjamUrl, client2);
15993
- 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);
15994
16142
  }
15995
16143
  /**
15996
16144
  * Create a new room. All peers connected to the same room will be able to send/receive streams to each other.
@@ -16089,7 +16237,19 @@ var FishjamClient = class {
16089
16237
  */
16090
16238
  async createLivestreamViewerToken(roomId) {
16091
16239
  try {
16092
- 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);
16093
16253
  return tokenResponse.data;
16094
16254
  } catch (error) {
16095
16255
  throw mapException(error);
@@ -16101,6 +16261,7 @@ var export_PeerStatus = import_fishjam_openapi2.PeerStatus;
16101
16261
  var export_RoomConfig = import_fishjam_openapi2.RoomConfig;
16102
16262
  var export_RoomConfigRoomTypeEnum = import_fishjam_openapi2.RoomConfigRoomTypeEnum;
16103
16263
  var export_RoomConfigVideoCodecEnum = import_fishjam_openapi2.RoomConfigVideoCodecEnum;
16264
+ var export_StreamerToken = import_fishjam_openapi2.StreamerToken;
16104
16265
  var export_ViewerToken = import_fishjam_openapi2.ViewerToken;
16105
16266
  export {
16106
16267
  BadRequestException,
@@ -16109,6 +16270,7 @@ export {
16109
16270
  FishjamNotFoundException,
16110
16271
  FishjamWSNotifier,
16111
16272
  ForbiddenException,
16273
+ MissingFishjamIdException,
16112
16274
  PeerNotFoundException,
16113
16275
  export_PeerOptions as PeerOptions,
16114
16276
  export_PeerStatus as PeerStatus,
@@ -16117,6 +16279,7 @@ export {
16117
16279
  export_RoomConfigVideoCodecEnum as RoomConfigVideoCodecEnum,
16118
16280
  RoomNotFoundException,
16119
16281
  ServiceUnavailableException,
16282
+ export_StreamerToken as StreamerToken,
16120
16283
  UnauthorizedException,
16121
16284
  UnknownException,
16122
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]>;