Skip to content
This repository has been archived by the owner on Apr 1, 2018. It is now read-only.

Added ping command #63

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ var lastSentPos = 0

// Ping server every 50 seconds to retain WebSocket connection
window.setInterval(function() {
send({cmd: 'ping'})
send({cmd: 'ping', randomdata: Math.random().toString(36).substring(7)})
}, 50000)


Expand Down
5 changes: 3 additions & 2 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,9 @@ function isMod(client) {

// `this` bound to client
var COMMANDS = {
ping: function() {
// Don't do anything
ping: function(args) {
var randomData = args.randomdata
send({cmd: 'pong', randomdata: randomData}, this)
},

join: function(args) {
Expand Down