code: function (method, result) {
  
        // 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
  
      }
docs: create send message method