mirror of
https://github.com/socketio/socket.io.git
synced 2026-04-30 03:00:39 -04:00
Renamed Socket#write > Socket#sendPacket
This commit is contained in:
@@ -142,7 +142,7 @@ Socket.prototype.probe = function (name) {
|
||||
, self = this
|
||||
|
||||
transport.once('open', function () {
|
||||
transport.write(parser.encodePacket('ping'));
|
||||
transport.send({ type: 'ping' });
|
||||
transport.once('message', function (message) {
|
||||
if ('pong' == message.type) {
|
||||
self.upgrading = true;
|
||||
@@ -218,7 +218,7 @@ Socket.prototype.onMessage = function (msg) {
|
||||
break;
|
||||
|
||||
case 'ping':
|
||||
this.write('pong');
|
||||
this.sendPacket('pong');
|
||||
break;
|
||||
|
||||
case 'error':
|
||||
@@ -263,19 +263,19 @@ Socket.prototype.flush = function () {
|
||||
*/
|
||||
|
||||
Socket.prototype.send = function (msg) {
|
||||
this.write('message', msg);
|
||||
this.sendPacket('message', msg);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Writes data.
|
||||
* Sends a packet.
|
||||
*
|
||||
* @param {String} packet type.
|
||||
* @param {String} data.
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Socket.prototype.write = function (type, data) {
|
||||
Socket.prototype.sendPacket = function (type, data) {
|
||||
var packet = { type: type, data: data };
|
||||
if ('open' != this.readyState || this.upgrading) {
|
||||
this.writeBuffer.push(packet);
|
||||
|
||||
Reference in New Issue
Block a user