Ver Mensaje Individual
  #3 (permalink)  
Antiguo 02/07/2014, 10:36
Avatar de stock
stock
 
Fecha de Ingreso: junio-2004
Ubicación: Monterrey NL
Mensajes: 2.390
Antigüedad: 20 años, 7 meses
Puntos: 53
Respuesta: crear un chat online

Aquí te dejo un ejemplo de como lo hice con NodeJS y Socket.io

https://github.com/crysfel/Chat

Lo más importante del lado del cliente es crear el socket:

Código Javascript:
Ver original
  1. this.socket = new io.Socket();
https://github.com/crysfel/Chat/blob...at-all.js#L207

Conectarse para luego enviar y recibir mensajes:
Código Javascript:
Ver original
  1. this.socket.on("connect",this.register,this);
  2.         this.socket.on("message",this.onMessage,this);
  3.         this.socket.on("disconnect",this.onDisconnect,this);
https://github.com/crysfel/Chat/blob...hat-all.js#L45

Lo que decidas hacer con esos mensajes ya depende de ti, para un char sería simplemente agregar los mensajes al dom para que el usuario los vea.

Suerte