(packet)
| 82 | override onData(data) { |
| 83 | debug("polling got data %s", data); |
| 84 | const callback = (packet) => { |
| 85 | // if its the first message we consider the transport open |
| 86 | if ("opening" === this.readyState && packet.type === "open") { |
| 87 | this.onOpen(); |
| 88 | } |
| 89 | |
| 90 | // if its a close packet, we close the ongoing requests |
| 91 | if ("close" === packet.type) { |
| 92 | this.onClose({ description: "transport closed by the server" }); |
| 93 | return false; |
| 94 | } |
| 95 | |
| 96 | // otherwise bypass onData and handle the message |
| 97 | this.onPacket(packet); |
| 98 | }; |
| 99 | |
| 100 | // decode payload |
| 101 | decodePayload(data, this.socket.binaryType).forEach(callback); |
no test coverage detected