jsgar 4.3.0 → 4.3.1

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/gar.umd.js CHANGED
@@ -123,6 +123,7 @@
123
123
  /**
124
124
  * Reset all connection-related state:
125
125
  * server/client topic/key mappings, counters, grace flags, and records.
126
+ * Note: Clients must call this to safely reconnect before running start() on a separate thread
126
127
  */
127
128
  clearConnectionState() {
128
129
  // Server assigned topic/key <-> name mappings
@@ -155,9 +156,6 @@
155
156
  * @param {number} [openTimeout=20] - Connection timeout in seconds
156
157
  */
157
158
  async connect(openTimeout = 20) {
158
- // Before attempting a new connection, clear any previous state
159
- this.clearConnectionState();
160
-
161
159
  let scaledOpenTimeout = openTimeout * this.timeoutScale;
162
160
 
163
161
  while (this.running && !this.connected) {
@@ -521,6 +519,9 @@
521
519
  * Start the client and send introduction message.
522
520
  */
523
521
  start() {
522
+ // Before attempting a new connection, clear any previous state
523
+ this.clearConnectionState();
524
+
524
525
  this.running = true;
525
526
  const introMsg = {
526
527
  message_type: 'Introduction',
package/gar.js CHANGED
@@ -117,6 +117,7 @@ class GARClient {
117
117
  /**
118
118
  * Reset all connection-related state:
119
119
  * server/client topic/key mappings, counters, grace flags, and records.
120
+ * Note: Clients must call this to safely reconnect before running start() on a separate thread
120
121
  */
121
122
  clearConnectionState() {
122
123
  // Server assigned topic/key <-> name mappings
@@ -149,9 +150,6 @@ class GARClient {
149
150
  * @param {number} [openTimeout=20] - Connection timeout in seconds
150
151
  */
151
152
  async connect(openTimeout = 20) {
152
- // Before attempting a new connection, clear any previous state
153
- this.clearConnectionState();
154
-
155
153
  let scaledOpenTimeout = openTimeout * this.timeoutScale;
156
154
 
157
155
  while (this.running && !this.connected) {
@@ -515,6 +513,9 @@ class GARClient {
515
513
  * Start the client and send introduction message.
516
514
  */
517
515
  start() {
516
+ // Before attempting a new connection, clear any previous state
517
+ this.clearConnectionState();
518
+
518
519
  this.running = true;
519
520
  const introMsg = {
520
521
  message_type: 'Introduction',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsgar",
3
- "version": "4.3.0",
3
+ "version": "4.3.1",
4
4
  "description": "A Javascript client for the GAR protocol",
5
5
  "type": "module",
6
6
  "main": "dist/gar.umd.js",