mirror of
https://github.com/socketio/socket.io.git
synced 2026-04-30 03:00:39 -04:00
Fixed support for Node.JS running socket.io-client.
This commit is contained in:
@@ -51,9 +51,17 @@
|
||||
*/
|
||||
|
||||
WS.prototype.open = function () {
|
||||
var Socket = 'MozWebSocket' in window ? MozWebSocket : WebSocket
|
||||
, query = io.util.query(this.socket.options.query)
|
||||
, self = this;
|
||||
var query = io.util.query(this.socket.options.query)
|
||||
, self = this
|
||||
, Socket
|
||||
|
||||
// if node
|
||||
Socket = require('websocket-client').WebSocket;
|
||||
// end node
|
||||
|
||||
if (!Socket) {
|
||||
Socket = window.MozWebSocket || window.WebSocket;
|
||||
}
|
||||
|
||||
this.websocket = new Socket(this.prepareUrl() + query);
|
||||
|
||||
@@ -143,6 +151,9 @@
|
||||
*/
|
||||
|
||||
WS.check = function () {
|
||||
// if node
|
||||
return true;
|
||||
// end node
|
||||
return ('WebSocket' in window && !('__addTask' in WebSocket))
|
||||
|| 'MozWebSocket' in window;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user