view release on metacpan or search on metacpan
socialcalc/third-party/Socket.IO-node/lib/socket.io/transports/htmlfile.js view on Meta::CPAN
HTMLFile.prototype._onConnect = function(req, res){
var self = this, body = '';
switch (req.method){
case 'GET':
Client.prototype._onConnect.call(this, req, res);
this.response.useChunkedEncodingByDefault = true;
this.response.shouldKeepAlive = true;
this.response.writeHead(200, {
'Content-Type': 'text/html',
'Connection': 'keep-alive',
'Transfer-Encoding': 'chunked'
});
this.response.write('<html><body>' + new Array(245).join(' '));
this._payload();
break;
case 'POST':
req.addListener('data', function(message){
body += message;
});
socialcalc/third-party/Socket.IO-node/lib/socket.io/transports/xhr-multipart.js view on Meta::CPAN
headers['Access-Control-Allow-Methods'] = req.headers['access-control-request-method'];
res.writeHead(200, headers);
res.write('ok');
res.end();
return;
}
switch (req.method){
case 'GET':
Client.prototype._onConnect.apply(this, [req, res]);
headers['Content-Type'] = 'multipart/x-mixed-replace;boundary="socketio"';
headers['Connection'] = 'keep-alive';
this.request.connection.addListener('end', function(){ self._onClose(); });
this.response.useChunkedEncodingByDefault = false;
this.response.shouldKeepAlive = true;
this.response.writeHead(200, headers);
this.response.write("--socketio\n");
if ('flush' in this.response) this.response.flush();
this._payload();
break;
case 'POST':
socialcalc/third-party/Socket.IO-node/support/socket.io-client/lib/transport.js view on Meta::CPAN
var msgs = this.decode(data);
if (msgs && msgs.length){
for (var i = 0, l = msgs.length; i < l; i++){
this.onMessage(msgs[i]);
}
}
};
/**
* All the transports have a dedicated timeout to detect if
* the connection is still alive. We clear the existing timer
* and set new one each time this function is called. When the
* timeout does occur it will call the `onTimeout` method.
*
* @api private
*/
Transport.prototype.setTimeout = function(){
var self = this;
if (this.timeout) clearTimeout(this.timeout);
this.timeout = setTimeout(function(){
self.onTimeout();
socialcalc/third-party/Socket.IO-node/support/socket.io-client/socket.io.js view on Meta::CPAN
var msgs = this.decode(data);
if (msgs && msgs.length){
for (var i = 0, l = msgs.length; i < l; i++){
this.onMessage(msgs[i]);
}
}
};
/**
* All the transports have a dedicated timeout to detect if
* the connection is still alive. We clear the existing timer
* and set new one each time this function is called. When the
* timeout does occur it will call the `onTimeout` method.
*
* @api private
*/
Transport.prototype.setTimeout = function(){
var self = this;
if (this.timeout) clearTimeout(this.timeout);
this.timeout = setTimeout(function(){
self.onTimeout();
socialcalc/third-party/lib/PocketIO/Transport/BasePolling.pm view on Meta::CPAN
$self->client_disconnected($conn);
}
);
my $body = $self->_format_message($conn->build_id_message);
return [
200,
[ 'Content-Type' => 'text/plain',
'Content-Length' => length($body),
'Connection' => 'keep-alive'
],
[$body]
];
}
sub _dispatch_stream {
my $self = shift;
my ($id) = @_;
my $conn = $self->find_connection($id);
socialcalc/third-party/lib/PocketIO/Transport/Htmlfile.pm view on Meta::CPAN
$handle->on_eof($close_cb);
$handle->on_error($close_cb);
$handle->on_heartbeat(sub { $conn->send_heartbeat });
my $id = $self->_wrap_into_script($conn->build_id_message);
$handle->write(
join "\x0d\x0a" => 'HTTP/1.1 200 OK',
'Content-Type: text/html',
'Connection: keep-alive',
'Transfer-Encoding: chunked',
'',
sprintf('%x', 244 + 12),
'<html><body>' . (' ' x 244),
sprintf('%x', length($id)),
$id,
''
);
$conn->on_write(
socialcalc/third-party/lib/PocketIO/Transport/XHRMultipart.pm view on Meta::CPAN
$handle->write($string);
}
);
$handle->on_heartbeat(sub { $conn->send_heartbeat });
$handle->write(
join "\x0d\x0a" => 'HTTP/1.1 200 OK',
qq{Content-Type: multipart/x-mixed-replace;boundary="$boundary"},
'Connection: keep-alive', '', ''
);
$conn->send_id_message($conn->id);
$self->client_connected($conn);
};
}
sub _dispatch_send {
my $self = shift;