@nsshunt/stsfhirclient 1.1.18 → 1.1.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.
@@ -4888,14 +4888,18 @@ class SocketIoClient extends tinyEmitterExports.TinyEmitter {
4888
4888
  this.#EstablishSocketConnect();
4889
4889
  return this;
4890
4890
  }
4891
+ // Engine Errors / Events
4891
4892
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
4892
- ConnectCallBack(socket) {
4893
+ EngineError(error) {
4893
4894
  }
4894
4895
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
4895
- SocketEventsCallBack(socket) {
4896
+ EngineReconnectError(error) {
4896
4897
  }
4897
4898
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
4898
- ErrorCallBack(error) {
4899
+ EngineConnectError(error) {
4900
+ }
4901
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
4902
+ EngineReconnect(attempt) {
4899
4903
  }
4900
4904
  /*
4901
4905
  emit<Ev extends EventNames<ClientToServerEvents>>(ev: Ev, ...args: EventParams<ClientToServerEvents, Ev>): Socket<ServerToClientEvents, ClientToServerEvents> {
@@ -4948,31 +4952,36 @@ class SocketIoClient extends tinyEmitterExports.TinyEmitter {
4948
4952
  this.#socket = lookup(this.#address, socketOptions);
4949
4953
  this.#socket.io.on("error", (err) => {
4950
4954
  this.LogErrorMessage(`socketDetail.socket.io.on('error'): [${err}] Address: [${this.#address}]`);
4955
+ this.EngineError(err);
4951
4956
  });
4952
4957
  this.#socket.io.on("reconnect_error", (err) => {
4953
4958
  this.LogErrorMessage(`socketDetail.socket.io.on('reconnect_error'): [${err}] Address: [${this.#address}]`);
4959
+ this.EngineReconnectError(err);
4954
4960
  });
4955
4961
  this.#socket.on("connect_error", (err) => {
4956
4962
  this.LogErrorMessage(`socketDetail.socket.on('connect_error'): [${err}] Address: [${this.#address}]`);
4963
+ this.EngineConnectError(err);
4957
4964
  });
4958
4965
  this.#socket.io.on("reconnect", (attempt) => {
4959
4966
  this.LogErrorMessage(`socketDetail.socket.io.on('reconnect'): Number: [${attempt}] Address: [${this.#address}]`);
4967
+ this.EngineReconnect(attempt);
4960
4968
  });
4961
4969
  this.#socket.on("connect", () => {
4962
4970
  if (this.#socket) {
4963
4971
  this.LogDebugMessage(`Socket: [${this.#socket.id}]: connected, Address: [${this.#address}]`);
4964
4972
  setTimeout(() => {
4965
- this.ConnectCallBack(this.#socket);
4973
+ this.SocketConnect(this.#socket);
4966
4974
  }, 0);
4967
- this.SocketEventsCallBack(this.#socket);
4975
+ this.SetupSocketEvents(this.#socket);
4968
4976
  } else {
4969
4977
  const errorMessage = "Could not get socket object from socket.io, Address: [${socketDetail.address}]";
4970
4978
  this.LogErrorMessage(errorMessage);
4971
- this.ErrorCallBack(new Error(errorMessage));
4979
+ this.SocketConnectError(new Error(errorMessage));
4972
4980
  }
4973
4981
  });
4974
4982
  this.#socket.on("disconnect", (reason) => {
4975
4983
  this.LogDebugMessage("socket disconnect: " + reason);
4984
+ this.SocketDisconnect(reason);
4976
4985
  switch (reason) {
4977
4986
  case "io server disconnect":
4978
4987
  {
@@ -5061,16 +5070,20 @@ class FhirSocketClient extends SocketIoClient {
5061
5070
  this.#options = options;
5062
5071
  this.#SetupWSSClient();
5063
5072
  }
5064
- ConnectCallBack(socket) {
5073
+ SocketConnect(socket) {
5065
5074
  this.LogDebugMessage(chalk.green(`FhirSocketClient:#OnSocketConnected(): ID: [${this.#id}] clientName: [${this.name}]: --> connected`));
5066
5075
  if (this.#options.joinRooms.length > 0 && socket) {
5067
5076
  socket.emit("__STSjoinRoom", this.#options.joinRooms);
5068
5077
  }
5069
5078
  }
5070
- ErrorCallBack(error) {
5079
+ SocketError(error) {
5071
5080
  this.LogErrorMessage(`FhirSocketClient:#SetupWSSClient(): Error clientName: [${this.name}]: SetupClientSideSocket call back: Error: [${error}]`);
5072
5081
  }
5073
- SocketEventsCallBack(socket) {
5082
+ SocketConnectError(error) {
5083
+ }
5084
+ SocketDisconnect(reason) {
5085
+ }
5086
+ SetupSocketEvents(socket) {
5074
5087
  }
5075
5088
  #SetupWSSClient = async () => {
5076
5089
  console.log(chalk.yellow(`FhirSocketClient:#SetupWSSClient(): ID: [${this.#id}] clientName: [${this.name}] Starting ...`));