@dxos/messaging 0.6.9 → 0.6.10-main.bbdfaa4

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.
@@ -2024,6 +2024,8 @@ var EdgeSignalManager = class extends Resource3 {
2024
2024
  }
2025
2025
  async _open() {
2026
2026
  this._ctx.onDispose(this._edgeConnection.addListener((message) => this._onMessage(message)));
2027
+ this._edgeConnection.reconnect.on(this._ctx, () => this._rejoinAllSwarms());
2028
+ await this._rejoinAllSwarms();
2027
2029
  }
2028
2030
  /**
2029
2031
  * Warning: PeerInfo is inferred from edgeConnection.
@@ -2033,12 +2035,12 @@ var EdgeSignalManager = class extends Resource3 {
2033
2035
  log7.warn("ignoring peer info on join request", {
2034
2036
  peer,
2035
2037
  expected: {
2036
- peerKey: this._edgeConnection.deviceKey.toHex(),
2037
- identityKey: this._edgeConnection.identityKey.toHex()
2038
+ peerKey: this._edgeConnection.peerKey,
2039
+ identityKey: this._edgeConnection.identityKey
2038
2040
  }
2039
2041
  }, {
2040
2042
  F: __dxlog_file7,
2041
- L: 51,
2043
+ L: 53,
2042
2044
  S: this,
2043
2045
  C: (f, a) => f(...a)
2044
2046
  });
@@ -2071,12 +2073,12 @@ var EdgeSignalManager = class extends Resource3 {
2071
2073
  log7.warn("ignoring author on send request", {
2072
2074
  author: message.author,
2073
2075
  expected: {
2074
- peerKey: this._edgeConnection.deviceKey,
2076
+ peerKey: this._edgeConnection.peerKey,
2075
2077
  identityKey: this._edgeConnection.identityKey
2076
2078
  }
2077
2079
  }, {
2078
2080
  F: __dxlog_file7,
2079
- L: 82,
2081
+ L: 84,
2080
2082
  S: this,
2081
2083
  C: (f, a) => f(...a)
2082
2084
  });
@@ -2111,7 +2113,7 @@ var EdgeSignalManager = class extends Resource3 {
2111
2113
  _processSwarmResponse(message) {
2112
2114
  invariant6(protocol.getPayloadType(message) === SwarmResponseSchema.typeName, "Wrong payload type", {
2113
2115
  F: __dxlog_file7,
2114
- L: 119,
2116
+ L: 121,
2115
2117
  S: this,
2116
2118
  A: [
2117
2119
  "protocol.getPayloadType(message) === SwarmResponseSchema.typeName",
@@ -2125,7 +2127,7 @@ var EdgeSignalManager = class extends Resource3 {
2125
2127
  topic
2126
2128
  }, {
2127
2129
  F: __dxlog_file7,
2128
- L: 123,
2130
+ L: 125,
2129
2131
  S: this,
2130
2132
  C: (f, a) => f(...a)
2131
2133
  });
@@ -2162,7 +2164,7 @@ var EdgeSignalManager = class extends Resource3 {
2162
2164
  _processMessage(message) {
2163
2165
  invariant6(protocol.getPayloadType(message) === AnySchema.typeName, "Wrong payload type", {
2164
2166
  F: __dxlog_file7,
2165
- L: 156,
2167
+ L: 158,
2166
2168
  S: this,
2167
2169
  A: [
2168
2170
  "protocol.getPayloadType(message) === AnySchema.typeName",
@@ -2172,7 +2174,7 @@ var EdgeSignalManager = class extends Resource3 {
2172
2174
  const payload = protocol.getPayload(message, AnySchema);
2173
2175
  invariant6(message.source, "source is missing", {
2174
2176
  F: __dxlog_file7,
2175
- L: 158,
2177
+ L: 160,
2176
2178
  S: this,
2177
2179
  A: [
2178
2180
  "message.source",
@@ -2181,7 +2183,7 @@ var EdgeSignalManager = class extends Resource3 {
2181
2183
  });
2182
2184
  invariant6(message.target, "target is missing", {
2183
2185
  F: __dxlog_file7,
2184
- L: 159,
2186
+ L: 161,
2185
2187
  S: this,
2186
2188
  A: [
2187
2189
  "message.target",
@@ -2190,7 +2192,7 @@ var EdgeSignalManager = class extends Resource3 {
2190
2192
  });
2191
2193
  invariant6(message.target.length === 1, "target should have exactly one item", {
2192
2194
  F: __dxlog_file7,
2193
- L: 160,
2195
+ L: 162,
2194
2196
  S: this,
2195
2197
  A: [
2196
2198
  "message.target.length === 1",
@@ -2207,7 +2209,26 @@ var EdgeSignalManager = class extends Resource3 {
2207
2209
  });
2208
2210
  }
2209
2211
  _matchSelfPeerInfo(peer) {
2210
- return peer && (peer.peerKey === this._edgeConnection.deviceKey.toHex() || peer.identityKey === this._edgeConnection.identityKey.toHex());
2212
+ return peer && (peer.peerKey === this._edgeConnection.peerKey || peer.identityKey === this._edgeConnection.identityKey);
2213
+ }
2214
+ async _rejoinAllSwarms() {
2215
+ log7("rejoin swarms", {
2216
+ swarms: Array.from(this._swarmPeers.keys())
2217
+ }, {
2218
+ F: __dxlog_file7,
2219
+ L: 181,
2220
+ S: this,
2221
+ C: (f, a) => f(...a)
2222
+ });
2223
+ for (const topic of this._swarmPeers.keys()) {
2224
+ await this.join({
2225
+ topic,
2226
+ peer: {
2227
+ peerKey: this._edgeConnection.peerKey,
2228
+ identityKey: this._edgeConnection.identityKey
2229
+ }
2230
+ });
2231
+ }
2211
2232
  }
2212
2233
  };
2213
2234