bruno_boccara
asked on
To do a chat like Facebook
Hello,
i want do a chat like facebook. I know to do that, i need to use technic of polling. But when i search in Web, there is many way. I want to know the best to do that.
I see with Jquery, it is possible to do Timeout/ajax to refresh the page and get data i want. But with timeout, there is many request and i don't think it is the best way to do that.
I heard angular but never try.
Thanks to help.
i want do a chat like facebook. I know to do that, i need to use technic of polling. But when i search in Web, there is many way. I want to know the best to do that.
I see with Jquery, it is possible to do Timeout/ajax to refresh the page and get data i want. But with timeout, there is many request and i don't think it is the best way to do that.
I heard angular but never try.
Thanks to help.
Don't poll, use sockets.io or something to use web sockets.
ASKER
Ok, i will look this. But it's hardcore to install this. I follow their instruction and it's don't work. You have a good tutorial for this ?
It is not that difficult, just visit http://socket.io/get-started/chat/ and get started. The code for this chat example is at https://github.com/guille/chat-example
How difficult is this
var io = require('socket.io')(80);
io.emit('message', 'Hello World!');
Keep in mind that socket.io is for node.JS
Using web sockets is a bit different and a bit more coding. Look at https://www.websocket.org/echo.html for a simple example
If you want an ASP.Net method, then check out signalR at http://www.asp.net/signalr/
Either way, just don't be intimidated by the code
How difficult is this
var io = require('socket.io')(80);
io.emit('message', 'Hello World!');
Keep in mind that socket.io is for node.JS
Using web sockets is a bit different and a bit more coding. Look at https://www.websocket.org/echo.html for a simple example
If you want an ASP.Net method, then check out signalR at http://www.asp.net/signalr/
Either way, just don't be intimidated by the code
ASKER
I follow like they say but i don't sucess.
The first step it's ok :
The second step too:
but the third and fourth step don't work :
i don't access at the page "hello world" when i do localhost:3000.
Sorry, first time i try to install this and it's seems very complicated for me.
The first step it's ok :
{
"name": "socket-chat-example",
"version": "0.0.1",
"description": "my first socket.io app",
"dependencies": {}
}
The second step too:
npm install --save express@4.10.2
but the third and fourth step don't work :
var app = require('express')();
var http = require('http').Server(app);
app.get('/', function(req, res){
res.send('<h1>Hello world</h1>');
});
http.listen(3000, function(){
console.log('listening on *:3000');
});
i don't access at the page "hello world" when i do localhost:3000.
Sorry, first time i try to install this and it's seems very complicated for me.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Sorry, i will try it and give a back fast. Thank for your answer.
ASKER
Hello, sorry for waiting. When i write npm install socket.io, i have many bug coming. I see many video to do this and i have always the same bug.
When i do npm install, i have error.
When i do npm install, i have error.
Have you check about Asp.Net SignalR?
ASP.NET SignalR is a new library for ASP.NET developers that makes developing real-time web functionality easy. SignalR allows bi-directional communication between server and client. Servers can now push content to connected clients instantly as it becomes available. SignalR supports Web Sockets, and falls back to other compatible techniques for older browsers. SignalR includes APIs for connection management (for instance, connect and disconnect events), grouping connections, and authorization.
You can check ready example available at
http://www.codeproject.com/Articles/562023/Asp-Net-SignalR-Chat-Room
http://www.codeproject.com/Articles/889257/Chat-Application-using-ASP-NET-SignalR
ASP.NET SignalR is a new library for ASP.NET developers that makes developing real-time web functionality easy. SignalR allows bi-directional communication between server and client. Servers can now push content to connected clients instantly as it becomes available. SignalR supports Web Sockets, and falls back to other compatible techniques for older browsers. SignalR includes APIs for connection management (for instance, connect and disconnect events), grouping connections, and authorization.
You can check ready example available at
http://www.codeproject.com/Articles/562023/Asp-Net-SignalR-Chat-Room
http://www.codeproject.com/Articles/889257/Chat-Application-using-ASP-NET-SignalR
ASKER
Yes, of course, i saw it. But at the moment, i work with PHP so... :). But SignalR seems to be very good also for developper's ASP.
Hi,
For Realtime web application in PHP, you could try Ratchet, Socket.IO, or SockJS library.
For more in details about that, please refer: https://entwickler.de/webandphp/building-realtime-web-apps-with-php-125787.html
For Realtime web application in PHP, you could try Ratchet, Socket.IO, or SockJS library.
For more in details about that, please refer: https://entwickler.de/webandphp/building-realtime-web-apps-with-php-125787.html
ASKER
Hi,
I want use Socket.IO but i don't success to install it. Many bugs all time.
I want use Socket.IO but i don't success to install it. Many bugs all time.