未经请求的消息:无效的rpc相关性

时间:2018-08-03 05:23:50

标签: javascript rpc deepstream.io

我在致电第二次提供商时遇到此错误。

1)server.js(已使用:NodeJS)

const ds = deepstream('<URL>');
const randomURL = Math.ceil(Math.random() * 10000).toString();
ds.rpc.provide(randomURL, (data, response) => {
  console.log("received request for: ", randomURL, data);
  response.send(`${Date.now()} Hello from random Service: ${randomURL}`);
})

2)cli​​ent.js(已使用:microjs

module.exports = async (req, res) => {
  let fullPath = req.url;
  fullPath = fullPath.split('/')[1];
  const result = await ds.rpc.make(fullPath, {}, (err, result) => {
    console.log("response received: ", err, result);
    res.end(result);
  });
  console.log(`result for ${fullPath} is: ${result}`);
}

第二次校准此网址后,我报错

localhost:port/randomURL

0 个答案:

没有答案