3 ms·
Yes, in 30 lines of code: http://tinyurl.com/chat-server-photon http://tinyurl.com/chat-server-photon As Photon is an application server, this means you can do
by LoicProcrast 16y ago
Yes, in 30 lines of code: http://tinyurl.com/chat-server-photon http://tinyurl.com/chat-server-photon
As Photon is an application server, this means you can do what you do easily with Django/RoR or a Java application server. This breaks the traditional one request, one reply, we forget everything approach of PHP. This is now possible rather nicely as PHP has improved a lot with respect to memory management in the last releases.
Disclaimer, I am the author of Photon and I am locked out of HackerNews with my normal account because of the great anti procrastination mode :-D
- trebor 16y agoIs that the entire script? I do not quite understand how that would comprise an entire project. Could you put it on github, perhaps? I'd like to browse thru a working Photon project.
- LoicProcrast 16y agoThis is effectively the entire "server side" views handling the jsSocket connection. The front end is a copy/paste of the chat available in the Mongrel2 examples. I will put up a full tutorial from a bare installation of Debian up to this chat server.
- deweller 16y agoVery nice. Doesn't the Mongrel2 Chat demo use Flash-based socket communication? I've haven't been able to figure out if Mongrel2 supports native websocket communications on the same port as http traffic (a la nodejs with Socket.IO).
- Loic 16y agoYes, here this is jsSocket with the little flash stuff to bring socket support to all browsers. WebSocket is coming soon into Mongrel2 (the protocol change delayed a bit the implementation).