Skip to content

Commit

Permalink
Add a default api for heartbeating.
Browse files Browse the repository at this point in the history
  • Loading branch information
lsm committed Oct 23, 2015
1 parent 395efcb commit 8f3aadf
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions lib/service/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,23 @@ Service.prototype.setupWeb = function() {
}

Service.prototype.setupRPC = function() {
if (this.api) {
this.rpcType = this.rpcType || 'axon'
var rpcOptions = {
api: this.api,
type: this.rpcType,
context: this,
isRemote: false
}
this.rpc = new RPC(rpcOptions)
if (!this.api) {
this.api = {}
}

// We need at least one api for heartbeating.
this.api.__ping = function(msg, callback) {
callback('pong')
}

this.rpcType = this.rpcType || 'axon'
var rpcOptions = {
api: this.api,
type: this.rpcType,
context: this,
isRemote: false
}
this.rpc = new RPC(rpcOptions)
}

/**
Expand Down

0 comments on commit 8f3aadf

Please sign in to comment.