Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
packets.forEach(function(packet) {
parser.encodePacket(packet, self.supportsBinary, function(data) {
debug('writing "%s"', data);
self.writable = false;
self.socket.send(data, packet.options, function (err){
if (err) return self.onError('write error', err.stack);
self.writable = true;
self.emit('drain');
});
});
});
};
WebSocket.prototype.send = function (packets) {
var self = this;
for (var i = 0, l = packets.length; i < l; i++) {
parser.encodePacket(packets[i], this.supportsBinary, function(data) {
debug('writing "%s"', data);
self.writable = false;
self.socket.send(data, function (err){
if (err) return self.onError('write error', err.stack);
self.writable = true;
self.emit('drain');
});
});
}
};
WebSocket.prototype.send = function (packets) {
var self = this;
for (var i = 0, l = packets.length; i < l; i++) {
parser.encodePacket(packets[i], this.supportsBinary, function(data) {
debug('writing "%s"', data);
self.writable = false;
self.socket.send(data, function (err){
if (err) return self.onError('write error', err.stack);
self.writable = true;
self.emit('drain');
});
});
}
};
WebSocket.prototype.send = function (packets) {
var self = this;
for (var i = 0, l = packets.length; i < l; i++) {
parser.encodePacket(packets[i], this.supportsBinary, function(data) {
debug('writing "%s"', data);
self.writable = false;
self.socket.send(data, function (err){
if (err) return self.onError('write error', err.stack);
self.writable = true;
self.emit('drain');
});
});
}
};
WS.prototype.write = function(packets){
for (var i = 0, l = packets.length; i < l; i++) {
this.socket.send(parser.encodePacket(packets[i]));
}
};