4

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

2
  • The question is not clear? Commented Oct 7, 2013 at 5:36
  • @Chandermani now you can understand what i am want to say ... Commented Oct 7, 2013 at 5:47

2 Answers 2

9

You have 3 ways:

Use node.js server

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.

Use PHP with sockets

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

Use PHP for API and Node for socket only

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

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you very much for this kind of information . Very helpfull ,+1 @Norbert Pisz
You Welcome. Please upvote and approve as answer if was helpfull :)
2

You don't need node.js if you don't want it. I wouldn't try mixing node and php.

If you want to use socket.io with php, take a look at elephant.io: http://elephant.io/#usage. I think it'll suit your needs.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.