Using meteor.js with php server

I developed an application that I would like to use meteor.js for real-time updates (I want to improve, but not change my program, for example, when the user adds comments that make the update in real time). The problem is that meteor.js uses node.js (therefore javascript as server code). I use the LAMP stack, is it possible to get PHP to transfer data to meteor.js from mysql.

+7
source share
4 answers

A meteor is more than just an "interactive web application" - a builder or javascript framework. The idea is to have only one programming language (besides HTML / CSS for markup) to do all the work. Basically, he creates a "remote server" (in the client browser), he can transfer data and simultaneously publish various APIs for users. The data transmitted through these APIs / connections has a specific structure that must be respected at any time.

Meteor is built around NodeJS, which makes it difficult (if not impossible) to run without this backend. Of course, you can try to simulate a backend using PHP, but that would be a waste of time. When reading your question, you will be better off using a javascript framework like jQuery or Prototype. Unlike Meteor, you will need to make AJAX calls (POST and CallBack) yourself, but you can decide which backend you want to use yourself (including PHP / MySQL).

If you still want to do this, you need to check the source code for Meteor and NodeJS to find out what minimum requirements are for Meteor to work under PHP. The PHP stack should interpret the Meteor commands of senders and receivers, but this will not be an easy task.

+10
source

You can use comet (or reverse ajax) for real-time updates.

+3
source

Trying to marry node.js with PHP doesn't seem like a good way to go down. If someone insisted on using a system like Meteor.js but with a PHP back-end, it would be more prudent to look at AngularJS, which is mostly client-side.

Of course, this is a different technology stack. If someone really insisted on mixing, you could use server sockets to interact with PHP web services; and / or use mongodb and / or mysql-node to interact with the same databases.

+1
source

I released a package meteorite that interacts with a Wordpress site with the Wordpress JSON API . Quick fix. Presently.

Comes with a backend code that will return raw data or the publication in which messages are stored using their identifier instead of a randomly generated mangoid. And some basic templates that you can run, including a session variable that tracks the selected post.

I am working on this a lot more and in the end I will have a version that directly calls mysql calls from node, so you will not need php or Wordpress; just the ability to access the mysql database (which can be remote, with the appropriate configuration, or on the same machine).

+1
source

All Articles