mirror of
https://github.com/socketio/socket.io.git
synced 2026-04-30 03:00:39 -04:00
Gitmodules update
Fixes for multipart, websocket, server-events Demo update
This commit is contained in:
2
.gitmodules
vendored
2
.gitmodules
vendored
@@ -3,4 +3,4 @@
|
||||
url = git://github.com/visionmedia/js-oo.git
|
||||
[submodule "test/client"]
|
||||
path = test/client
|
||||
url = git@github.com:RosePad/Socket.IO-client.git
|
||||
url = git@github.com:RosePad/Socket.IO.git
|
||||
|
||||
@@ -11,7 +11,6 @@ this.Client = Class({
|
||||
|
||||
send: function(message){
|
||||
if (!this.connected || !(this.connection.readyState == 'open' || this.connection.readyState == 'writeOnly')) return this._queue(message);
|
||||
sys.log('will deliver ' + message + ' to ' + this.sessionId);
|
||||
this._write(JSON.stringify({messages: [message]}));
|
||||
return this;
|
||||
},
|
||||
@@ -62,7 +61,6 @@ this.Client = Class({
|
||||
var self = this;
|
||||
this.connected = false;
|
||||
this._disconnectTimeout = setTimeout(function(){
|
||||
sys.log('timeout!');
|
||||
self._onDisconnect();
|
||||
}, this.listener.options.timeout);
|
||||
},
|
||||
|
||||
@@ -39,7 +39,8 @@ this['server-events'] = Client.extend({
|
||||
},
|
||||
|
||||
_write: function(message){
|
||||
this.response.write("Event: socket.io\ndata: " + message);
|
||||
this.response.write("Event: socket.io");
|
||||
this.response.write("data: " + message);
|
||||
}
|
||||
|
||||
});
|
||||
@@ -34,7 +34,7 @@ this.websocket = Client.extend({
|
||||
});
|
||||
});
|
||||
|
||||
// this.response.use_chunked_encoding_by_default = false;
|
||||
this.response.use_chunked_encoding_by_default = false;
|
||||
this.response.writeHeader(101, 'Web Socket Protocol Handshake', {
|
||||
'Upgrade': 'WebSocket',
|
||||
'Connection': 'Upgrade',
|
||||
|
||||
@@ -7,7 +7,8 @@ this['xhr-multipart'] = Client.extend({
|
||||
var self = this;
|
||||
switch (req.method){
|
||||
case 'GET':
|
||||
var self = this;
|
||||
var self = this;
|
||||
this.__super__(req, res);
|
||||
this.request.addListener('end', function(){
|
||||
if (!('hijack' in self.connection)){
|
||||
throw new Error('You have to patch Node! Please refer to the README');
|
||||
@@ -16,13 +17,14 @@ this['xhr-multipart'] = Client.extend({
|
||||
self.connection.addListener('end', function(){ self._onClose(); });
|
||||
self.connection.hijack();
|
||||
self.connection.setTimeout(0);
|
||||
self.response.use_chunked_encoding_by_default = false;
|
||||
});
|
||||
|
||||
this.response.use_chunked_encoding_by_default = false;
|
||||
this.response.writeHead(200, {
|
||||
'Content-type': 'multipart/x-mixed-replace;boundary=socketio'
|
||||
'Content-Type': 'multipart/x-mixed-replace;boundary=socketio',
|
||||
'Connection': 'keep-alive'
|
||||
});
|
||||
this.response.write("--socketio\r\n");
|
||||
this.response.write("--socketio\n");
|
||||
this.response.flush();
|
||||
|
||||
this._payload();
|
||||
@@ -43,9 +45,10 @@ this['xhr-multipart'] = Client.extend({
|
||||
},
|
||||
|
||||
_write: function(message){
|
||||
this.response.write("Content-type: text/plain\r\n");
|
||||
this.response.write(message);
|
||||
this.response.write("\r\n--socketio\r\n");
|
||||
this.response.write("Content-Type: text/plain\n\n");
|
||||
this.response.write(message + "\n");
|
||||
this.response.write("--socketio\n");
|
||||
this.response.flush();
|
||||
}
|
||||
|
||||
});
|
||||
@@ -4,7 +4,6 @@
|
||||
<title>socket.io client test</title>
|
||||
|
||||
<script src="/client/lib/vendor/js-oo/lib/oo.js"></script>
|
||||
<script src="/client/lib/vendor/LABjs/LAB.src.js"></script>
|
||||
<script src="/client/lib/io.js"></script>
|
||||
<script src="/client/lib/util/util.js"></script>
|
||||
<script src="/client/lib/util/object.js"></script>
|
||||
@@ -21,11 +20,15 @@
|
||||
<script src="/client/lib/transports/xhr-multipart.js"></script>
|
||||
<script src="/client/lib/transports/xhr-polling.js"></script>
|
||||
<script src="/client/lib/socket.js"></script>
|
||||
|
||||
<script src="/client/lib/vendor/web-socket-js/swfobject.js"></script>
|
||||
<script src="/client/lib/vendor/web-socket-js/FABridge.js"></script>
|
||||
<script src="/client/lib/vendor/web-socket-js/web_socket.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<script>
|
||||
io.path = '/client/';
|
||||
io.setPath('/client/');
|
||||
|
||||
function message(obj){
|
||||
var el = document.createElement('p');
|
||||
@@ -42,7 +45,7 @@
|
||||
document.getElementById('text').value = '';
|
||||
}
|
||||
|
||||
var socket = new io.Socket('localhost', {rememberTransport: false, transports:['xhr-polling'], port: 8080});
|
||||
var socket = new io.Socket('localhost', {rememberTransport: false, port: 8080});
|
||||
socket.connect();
|
||||
socket.addEvent('message', function(data){
|
||||
var obj = io.util.JSON.decode(data);
|
||||
|
||||
Submodule test/client updated: 042b4d7f9a...f8228d9466
Reference in New Issue
Block a user