(prefix: DataPrefix, suffix: string, field: string)
| 125 | } |
| 126 | } |
| 127 | unsubscribe(prefix: DataPrefix, suffix: string, field: string) { |
| 128 | const fullKey = getFullKey(prefix, suffix, field); |
| 129 | |
| 130 | if (!this.subscriptions.has(fullKey)) { |
| 131 | return; |
| 132 | } |
| 133 | |
| 134 | this._logger.sub('unsubscribe').info(fullKey); |
| 135 | |
| 136 | this.subscriptions.delete(fullKey); |
| 137 | |
| 138 | this.pending.delete(fullKey); |
| 139 | |
| 140 | internals.realtime.subscriptions[fullKey].delete(this); |
| 141 | |
| 142 | if (internals.realtime.subscriptions[fullKey].size === 0) { |
| 143 | delete internals.realtime.subscriptions[fullKey]; |
| 144 | |
| 145 | internals.realtime.pending.get(fullKey)?.resolve(undefined); |
| 146 | internals.realtime.pending.delete(fullKey); |
| 147 | |
| 148 | delete internals.realtime.values[fullKey]; |
| 149 | |
| 150 | internals.realtime.pushCommand({ |
| 151 | type: RealtimeCommandType.UNSUBSCRIBE, |
| 152 | args: [prefix, suffix, field], |
| 153 | }); |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | destroy() { |
| 158 | for (const channel of this.subscriptions) { |
no test coverage detected