How to add realtime-api

I want to develop a new realtime-api
For example

  1. Create a file in /packages/rocketchat-lib/server/functions, name it as getMessageHistory.js, the content is as same as loadMessageHistory.js, of course, i will replace loadMessageHistory to getMessageHistory
  2. Create a file in /packages/rocketchat-lib/server/methods, name it as getHistory.js, write some code , register methods
Meteor.methods({
  getHistory () {....}
})
  1. In /packages/rocketchat-lib/package.js, add
api.addFiles('server/functions/getMessageHistory.js', 'server');
api.addFiles('server/methods/getHistory.js', 'server');
  1. call the method getHistory
{
  id: ""
  method: "getHistory"
  msg: "method"
  params: ["E9TJgqz3B9C8xZRsgpFKb842Pfq8cwZyuE", 1543248000000, 1543334399000]
}

At last , i get the response:

{
  error: {
    error: 404
    errorType: "Meteor.Error"
    isClientSafe: true
    message: "Method 'getHistory' not found [404]"
    reason: "Method 'getHistory' not found"
  },
  id: ""
  msg: "result"
}

It must something wrong, but i don’t know, can somebody tell me ? thanks

Have you tried add the method to one of the existing files just to see if related to the file you’ve added?