角与socket.io&安培;后端PHP [英] Angular with socket.io & backend php

查看:141
本文介绍了角与socket.io&安培;后端PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的实时应用(聊天)及使用角度和我的后台是php(codeigniter RESTAPI)
 在MongoDB的数据库
我听到的地方, socket.io 是插座最好的图书馆(用于实时)
我看到socket.io大多与node.js的使用,所以可能我需要节点或其他可行的方法的基础知识与工作socket.io,角和PHP

I am working on realtime app (chat) & using angular and my backend is php(codeigniter restapi) for database in mongodb I hear somewhere that socket.io is best library for socket (use for real time) , and i see socket.io is mostly use with node.js , so may i need basic knowledge of node or any other feasible way to work with socket.io , angular and php

推荐答案

您有3种方式:

*的使用的node.js服务器*

这要看有多大你的API。但在我看来MongoDB的插座的node.js会比PHP.Why更好吗? MongoDB的使用JSON格式,是的NodeJS服务器的JavaScript所以它是更好地处理JSON。还具有的NodeJS非阻塞IO所以这将是更快套接字比PHP。
你可以阅读更多的在这里
是的NodeJS非常简单易学。

It depends how large is your API. But in my opinion for MongoDb and sockets node.js will be better than PHP.Why? MongoDB using JSON format and NodeJS is javascript server so it is better to handle JSON. Also NodeJS have non-blocking IO so it will be faster for socket than PHP. You can read more Here. NodeJS is very simple to learn.

*的使用PHP与插座*

您并不需要,如果你有alredy PHP开始新的node.js服务器。您可以使用类似的库来socket.io。让我们检查:
大象IO

You don't need to start new node.js server if you have alredy PHP. You can use library similar to socket.io. Lets check: Elephant IO

*的使用PHP API和节点的插座只*

我觉得你并不需要使用的所有数据的API接口。所以,你只能为插座电话和PHP服务器的API调用创建节点服务器。

I think you don't need to use all data from API for socket. So you can create node server only for sockets calls and PHP server for API calls.

这篇关于角与socket.io&安培;后端PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆