()
| 1407 | // encodePacket efficient as it uses WS framing |
| 1408 | // no need for encodePayload |
| 1409 | var _loop = function _loop() { |
| 1410 | var packet = packets[i]; |
| 1411 | var lastPacket = i === packets.length - 1; |
| 1412 | encodePacket(packet, _this2.supportsBinary, function (data) { |
| 1413 | // Sometimes the websocket has already been closed but the browser didn't |
| 1414 | // have a chance of informing us about it yet, in that case send will |
| 1415 | // throw an error |
| 1416 | try { |
| 1417 | _this2.doWrite(packet, data); |
| 1418 | } catch (e) {} |
| 1419 | if (lastPacket) { |
| 1420 | // fake drain |
| 1421 | // defer to next tick to allow Socket to clear writeBuffer |
| 1422 | nextTick(function () { |
| 1423 | _this2.writable = true; |
| 1424 | _this2.emitReserved("drain"); |
| 1425 | }, _this2.setTimeoutFn); |
| 1426 | } |
| 1427 | }); |
| 1428 | }; |
| 1429 | for (var i = 0; i < packets.length; i++) { |
| 1430 | _loop(); |
| 1431 | } |
no test coverage detected