lib/json-rpc2-server.js
function (result) {

      // don't send a second response
      if (responseHasBeenSent) {
        console.warn('JSON-RPC2 response has already been sent.')
        return
      }
      // notifications should not send error responses (JSON-RPC2 specs)
      if (!isMethodCall) {
        logNotificationResponseWarning(result, requestMessage)
        callback()
        return
      }

      // result should not be undefined
      if (result === undefined) {
        console.warn('JSON-RPC2 response from method ' + methodName + ' should return a result. (JSON-RPC2 spec)')
        result = ''
      }

      var rpcMessage = {
        jsonrpc: '2.0',
        result: result,
        id: id
      }

      callback(rpcMessage)
      responseHasBeenSent = true

    }
function (result) {

      // don't send a second response
      if (responseHasBeenSent) {
        console.warn('JSON-RPC2 response has already been sent.')
        return
      }
      // notifications should not send error responses (JSON-RPC2 specs)
      if (!isMethodCall) {
        logNotificationResponseWarning(result, requestMessage)
        callback()
        return
      }

      // result should not be undefined
      if (result === undefined) {
        console.warn('JSON-RPC2 response from method ' + methodName + ' should return a result. (JSON-RPC2 spec)')
        result = ''
      }

      var rpcMessage = {
        jsonrpc: '2.0',
        result: result,
        id: id
      }

      callback(rpcMessage)
      responseHasBeenSent = true

    }
function ( result ) { // don't send a second response if ( responseHasBeenSent ) { console . warn ( 'JSON-RPC2 response has already been sent.' ) return } // notifications should not send error responses (JSON-RPC2 specs) if ( ! isMethodCall ) { logNotificationResponseWarning ( result , requestMessage ) callback ( ) return } // result should not be undefined if ( result === undefined ) { console . warn ( 'JSON-RPC2 response from method ' + methodName + ' should return a result. (JSON-RPC2 spec)' ) result = '' } var rpcMessage = { jsonrpc : '2.0' , result : result , id : id } callback ( rpcMessage ) responseHasBeenSent = true }
create send result handler
create send result handler