@4players/odin-plugin-web 1.0.0-alpha.19 → 1.0.0-alpha.20

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.
@@ -13,7 +13,7 @@ import { logger, Transport } from '..';
13
13
  import { Token } from '../token';
14
14
  import { RpcConnection, TypedRpcConnection } from '../rpcConnection';
15
15
  import { HealthCheckTimeout } from '../config';
16
- import { version } from '../../version';
16
+ import * as pkg from '../../../package.json';
17
17
  export class H3MainConnection {
18
18
  get closeSignal() {
19
19
  return this.closeController.signal;
@@ -27,7 +27,7 @@ export class H3MainConnection {
27
27
  static create(id, address, onDatagram, signal) {
28
28
  return __awaiter(this, void 0, void 0, function* () {
29
29
  try {
30
- const url = new URL(`https://${address}?version=${version}`);
30
+ const url = new URL(`https://${address}?version=${pkg.version}`);
31
31
  const closeController = new AbortController();
32
32
  signal.addEventListener('abort', () => closeController.abort(), {
33
33
  once: true,
@@ -52,6 +52,7 @@ export declare class Room implements Backend.Room {
52
52
  get mainConnection(): MainConnection | undefined;
53
53
  constructor(id: number, connectionPool: ConnectionPool, parameters: JoinRoomParameters, options: WebPluginOptions);
54
54
  get token(): string;
55
+ get cipher(): Backend.Cipher | undefined;
55
56
  request(method: string, properties: unknown): Promise<unknown>;
56
57
  link(media: Backend.Media): Promise<void>;
57
58
  unlink(media: Backend.Media): void;
@@ -111,6 +111,9 @@ export class Room {
111
111
  get token() {
112
112
  return this._Connection.token.text;
113
113
  }
114
+ get cipher() {
115
+ return undefined; // not implemented
116
+ }
114
117
  request(method, properties) {
115
118
  return this._Connection.request(method, properties);
116
119
  }
@@ -25,7 +25,6 @@ export class VideoCapture {
25
25
  }
26
26
  start(room, media, uid) {
27
27
  var _a;
28
- console.log('Eyvor VideoCapture start()');
29
28
  let entry = this._Medias.get(media.connectionId);
30
29
  if (entry === undefined) {
31
30
  this._Medias.set(media.connectionId, (entry = new Set()));
@@ -204,7 +204,7 @@ export class RoomConnection {
204
204
  const selector = new Selector([
205
205
  () => sleep(this.renewTokenIn, 'renewToken'),
206
206
  () => sleep(500, 'tick'),
207
- () => __awaiter(this, void 0, void 0, function* () { var _b; return yield ((_b = this._RoomConnection) === null || _b === void 0 ? void 0 : _b.recv()); }),
207
+ () => __awaiter(this, void 0, void 0, function* () { var _a; return yield ((_a = this._RoomConnection) === null || _a === void 0 ? void 0 : _a.recv()); }),
208
208
  () => this._Closed,
209
209
  () => main.closePromise,
210
210
  ]);
@@ -32,7 +32,9 @@ export class RpcConnection {
32
32
  stream.binaryType = 'arraybuffer';
33
33
  }
34
34
  else {
35
- readRpcFromStream(stream.readable.getReader(), this._OnRpcMessage.bind(this)).finally(this.close.bind(this));
35
+ readRpcFromStream(stream.readable.getReader(), this._OnRpcMessage.bind(this))
36
+ .catch(console.error)
37
+ .finally(this.close.bind(this));
36
38
  this._Writer = stream.writable.getWriter();
37
39
  }
38
40
  this._Close.signal.addEventListener('abort', this._Cleanup.bind(this), {
@@ -256,7 +258,7 @@ function readRpcFromStream(reader, onRpc) {
256
258
  let offset = 0;
257
259
  for (let size;; offset += size) {
258
260
  size = getByteSize(buffer, offset);
259
- if (!size)
261
+ if (!size || offset + buffer.length < size)
260
262
  break;
261
263
  onRpc(buffer.subarray(offset, offset + size));
262
264
  }