MCPcopy Create free account
hub / github.com/SocketCluster/socketcluster / next

Method next

app/public/socketcluster-client.js:8706–8739  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8704 }
8705
8706 async next() {
8707 this.stream.setConsumer(this.id, this);
8708
8709 while (true) {
8710 if (!this.currentNode.next) {
8711 try {
8712 await this._waitForNextItem(this.timeout);
8713 } catch (error) {
8714 this._destroy();
8715 throw error;
8716 }
8717 }
8718 if (this._killPacket) {
8719 this._destroy();
8720 let killPacket = this._killPacket;
8721 delete this._killPacket;
8722
8723 return killPacket;
8724 }
8725
8726 this.currentNode = this.currentNode.next;
8727 this.releaseBackpressure(this.currentNode.data);
8728
8729 if (this.currentNode.consumerId && this.currentNode.consumerId !== this.id) {
8730 continue;
8731 }
8732
8733 if (this.currentNode.data.done) {
8734 this._destroy();
8735 }
8736
8737 return this.currentNode.data;
8738 }
8739 }
8740
8741 return() {
8742 delete this.currentNode;

Callers 2

nextMethod · 0.45

Calls 4

_waitForNextItemMethod · 0.95
_destroyMethod · 0.95
releaseBackpressureMethod · 0.95
setConsumerMethod · 0.80

Tested by

no test coverage detected