Skip to content

Commit

Permalink
update for socket.io
Browse files Browse the repository at this point in the history
  • Loading branch information
py8765 committed Oct 23, 2015
1 parent 34292b4 commit f570144
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
5 changes: 3 additions & 2 deletions bin/pomelo
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';
#!/usr/bin/env node

"use strict";

/**
* Module dependencies.
*/
Expand Down Expand Up @@ -368,7 +369,7 @@ function copy(origin, target) {
* @param {Function} fn
*/
function mkdir(path, fn) {
mkdirp(path, 0755, function(err){
mkdirp(path, '0755', function(err){
if(err) {
throw err;
}
Expand Down
9 changes: 3 additions & 6 deletions lib/connectors/sioconnector.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';
var util = require('util');
var EventEmitter = require('events').EventEmitter;
var sio = require('socket.io');
var sio = require('socket.io')();
var SioSocket = require('./siosocket');

var PKG_ID_BYTES = 4;
Expand All @@ -23,7 +23,6 @@ var Connector = function(port, host, opts) {
this.port = port;
this.host = host;
this.opts = opts;
this.heartbeats = opts.heartbeats || true;
this.closeTimeout = opts.closeTimeout || 60;
this.heartbeatTimeout = opts.heartbeatTimeout || 60;
this.heartbeatInterval = opts.heartbeatInterval || 25;
Expand All @@ -40,20 +39,18 @@ Connector.prototype.start = function(cb) {
var self = this;
// issue https://github.com/NetEase/pomelo-cn/issues/174
if(!!this.opts) {
console.error('opts: %j', this.opts);
this.wsocket = sio.listen(this.port, this.opts);
}
else {
this.wsocket = sio.listen(this.port, {
transports: [
'websocket', 'htmlfile', 'xhr-polling', 'jsonp-polling', 'flashsocket'
'websocket', 'polling'
]
});
}
this.wsocket.set('close timeout', this.closeTimeout);
this.wsocket.set('heartbeat timeout', this.heartbeatTimeout);
this.wsocket.set('heartbeat interval', this.heartbeatInterval);
this.wsocket.set('heartbeats', this.heartbeats);
this.wsocket.set('log level', 1);
this.wsocket.sockets.on('connection', function (socket) {
var siosocket = new SioSocket(curId++, socket);
self.emit('connection', siosocket);
Expand Down

0 comments on commit f570144

Please sign in to comment.