Using meteor.js with php server side

前端 未结 4 1687
终归单人心
终归单人心 2020-12-18 03:12

I\'ve developed an application that I would like to use meteor.js for real time updates (I want to enhance but not change my program, for example when a user adds a comments

相关标签:
4条回答
  • 2020-12-18 03:32

    You can use comet (or reverse ajax) for realtime updates.

    0 讨论(0)
  • 2020-12-18 03:53

    Trying to marry node.js with PHP doesn't sound like a worthwhile path to go down. If someone insisted on using a system like Meteor.js, yet with a PHP back-end, it would make more sense to look at AngularJS which is mainly the client side.

    Of course, that is different technology stack. If someone really insisted on the blending, one could consider using server side sockets to interact with PHP Web services; and/or use mongodb and/or mysql-node to interact with the same databases.

    0 讨论(0)
  • 2020-12-18 03:55

    Meteor is more than just an 'interactive webapplication'-builder or javascript framework. The idea is to have only one programming language (besides HTML/CSS for markup) to do all the work. Basically it creates a 'remote server' (in the clients browser) it can push data to and at the same time it publishes various API's to the users system. The data passed through these API's / connections has a specific structure which has to be adhered at all time.

    Meteor is built around NodeJS, which makes it hard (if not impossible) to run it without this backend. Sure you can try to mimic the backend using PHP, but it would be a waste of time. Reading your question you'll be better of using a javascript framework like jQuery or Prototype. Unlike Meteor you will need to do the AJAX calls (POST & CallBack) yourself, but you can actually decide which backend you want to use yourself (including PHP / MySQL).

    If you want to do this anyway you need to check the Meteor & NodeJS source code to see what the minimum requirements are to make Meteor run under PHP. The PHP stack has to interpret the commands Meteor sends and receivers, but this won't be an easy task.

    0 讨论(0)
  • 2020-12-18 03:57

    I released a meteorite package that interacts with a Wordpress site that has the Wordpress JSON API. A quick fix. For now.

    Comes with a backend call that will return the raw data, or a publication that stores the posts using their id's instead of a randomly generated mongoid. And some basic templates to get you started including a Session variable that keeps track of the currently selected post.

    I'm working on it a lot more and will eventually have a version that directly makes mysql calls from node so you won't 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).

    0 讨论(0)
提交回复
热议问题