@nsshunt/stsfhirclient 1.1.18 → 1.1.19

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