mirror of
https://github.com/wassname/GarageServer.IO.git
synced 2026-07-10 00:20:07 +08:00
Progress: Server Loops
This commit is contained in:
@@ -23,9 +23,9 @@ GarageServer.prototype.registerSocketEvents = function (options) {
|
||||
self.onPlayerInput(socket, input, options);
|
||||
});
|
||||
|
||||
socket.on('ping', function () {
|
||||
socket.on('ping', function (data) {
|
||||
console.log('garageserver.io:: socket ping');
|
||||
self.onPlayerInput(socket, options);
|
||||
self.onPing(socket, data, options);
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -51,8 +51,11 @@ GarageServer.prototype.onPlayerInput = function (socket, input, options) {
|
||||
}
|
||||
};
|
||||
|
||||
GarageServer.prototype.onPing = function(socket, options) {
|
||||
|
||||
GarageServer.prototype.onPing = function(socket, data, options) {
|
||||
socket.emit('ping', data);
|
||||
if(options.onPing) {
|
||||
options.onPing(socket, data);
|
||||
}
|
||||
};
|
||||
|
||||
exports.createGarageServer = function (io, options){
|
||||
|
||||
Reference in New Issue
Block a user