Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Laravel网站中使用Meteor服务_Meteor - Fatal编程技术网

如何在Laravel网站中使用Meteor服务

如何在Laravel网站中使用Meteor服务,meteor,Meteor,我有一个基于Laravel的应用程序。 该应用程序的目的是执行货物交付。 它涉及实时跟踪 另一方面,我正在Angular和Meteor上构建相同的应用程序 同时,我想在Meteor数据库(mongodb)中存储跟踪数据 是否有任何方式可以访问Meteor服务器到我的Laravel应用程序中以显示实时跟踪 更新 我尝试了Paulo Mogollón的解决方案,但我面临着这个错误: Loading failed for the module with source file:///E:/Dev/la

我有一个基于Laravel的应用程序。 该应用程序的目的是执行货物交付。 它涉及实时跟踪

另一方面,我正在Angular和Meteor上构建相同的应用程序

同时,我想在Meteor数据库(mongodb)中存储跟踪数据

是否有任何方式可以访问Meteor服务器到我的Laravel应用程序中以显示实时跟踪

更新

我尝试了Paulo Mogollón的解决方案,但我面临着这个错误:

Loading failed for the module with source file:///E:/Dev/laravelapp/node_modules/isomorphic-ws/index.d.ts

您可以在任何地方使用js和软件包连接到meteor服务器,基本上就是这样做的

npm install simpleddp isomorphic-ws --save


import ws from 'isomorphic-ws';
import simpleDDP from 'simpleDDP'; // ES6

const opts = {
    endpoint: "ws://someserver.com/websocket",
    SocketConstructor: ws,
    reconnectInterval: 5000
};
const server = new simpleDDP(opts);


let userSub = server.subscribe("user_pub");
let otherSub = server.subscribe("other_pub", 'param1', 2); // you can specify arguments for subscription

(async ()=>{
    await userSub.ready();
    let nextSub = server.subscribe("next_pub"); // subscribing after sub is ready
    await nextSub.ready();
    //all subs are ready here
})();

您可以在包repo中找到更多示例和信息。希望这能给您带来正确的方向。

检查您是否安装了两个模块
npm安装simpledp同构ws--save

顺便问一下,您是否安装了
node.js
npm
?您还应该像webpack一样配置构建管理器。或者,您可以下载这些LIB的简化预编译版本:


您想从laravel后端调用meteor,然后在meteor应用程序前端显示数据,对吗?如果是这样,您可以在meteor上创建一个rest端点,您可以从laravel调用它,将数据存储在mongodb上,然后它将填充您的实时跟踪图表或地图。实际上,我想将我的laravels前端与meteor连接。我需要laravel前端的meteors反应请检查我的代码:我收到了这个错误:加载源为“”的模块失败file:///E:/Dev/laravelapp/node_modules/isomorphic-ws/index.d.ts.“@StormTrooper,浏览器无法运行typescript。您需要为浏览器导入js文件:
import./node\u modules/isomorphic ws/browser.js
现在我得到了TypeError:Error resolving module specifier:simpleddp Core我已经安装了它们,路径也正确。请尝试预编译版本,只需下载它们并作为普通js文件使用。您也可以检查这一点。