[英]Web application using Node.js/socket.io and php/mysql
I am relatively new to node.js and socket.io. 我对node.js和socket.io相对较新。 Currently I have a half finished private web project, which runs only with PHP with a MySQL database on the server side. 目前,我有一个半成品的私有Web项目,仅在服务器端使用带有MySQL数据库的PHP运行。 I decided to bring it to a more advanced level using socket.io, for several features within the project. 我决定使用socket.io将其提升到更高的级别,以实现项目中的一些功能。
So I read a lot about it and watched a whole bunch of tutorials. 因此,我阅读了很多,并观看了很多教程。 Also I found this and this during my research. 此外,我发现这和这个我的研究过程中。
My question is, if that is still the common way to develop a web application? 我的问题是,这是否仍然是开发Web应用程序的常用方法?
More exactly: to use on one event (like a form submit) both an AJAX request and a socket.emit, for those events it is necessary/wanted. 更准确地说:要在一个事件(如表单提交)上同时使用AJAX请求和socket.emit,对于这些事件,这是必需的/需要的。
The background of this thought is the following. 这种思想的背景如下。 I have a whole bunch of calculations running now in PHP. 我现在在PHP中运行大量计算。 And the node.js server runs logically in JavaScript. 并且node.js服务器在JavaScript中逻辑运行。 So I can easily implement a node.js server without changing anything on my AJAX requests. 因此,我可以轻松实现node.js服务器,而无需更改AJAX请求中的任何内容。 Or rewrite everything I have so far, to js and use only a node.js server. 或将到目前为止的所有内容重写为js,仅使用node.js服务器。
But this leads to 3 more questions: 但这又引出3个问题:
json_decode(), json_encode(), ...
) but Node.js don't require JSON data to be converted. PHP具有许多可用于JSON数据的功能( json_decode(), json_encode(), ...
但是Node.js不需要转换JSON数据。 In the end, it really depend on your usage and how you plan to store and use that data 最后,这实际上取决于您的使用情况以及您计划如何存储和使用该数据
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.