List Info

Thread: i wrote a chatroom server




i wrote a chatroom server
country flaguser name
United States
2007-08-27 16:22:48
Hi,

I'm new to networking and wrote a simple chat server and
client to  
see how eventmachine works.

server: http://pastie.caboo.se/9
1452
client: http://pastie.caboo.se/9
1453

Notes:

supported commands: say something, change username, quit.
it's a  
chat*room*: all users send their chat to everyone else. more
features  
(channels, private messages, etc) would be easy to add.

the client sends messages in the format (no commas):  
command,separator,message,separator

so there is a "message" inside each
"message". that was a bad way to  
name it.

overall this was easy!



I think I'm done working on it now since I don't actually
intend to  
use it. Any comments on coding style/approach mistakes would
still be  
appreciated. Also Francis mentioned wanting to have one good
chat  
server implementation to put in the eventmachine distro, I
guess as a  
code sample -- if you like mine but there are specific
features/ 
changes it needs to be used I'd be open to adding them.


I plan to work on a boardgame program next w/ multiplayer
via  
eventmachine. One thing I'm not sure how to do yet is to use
 
eventmachine in the game loop. I think I'd like to be able
to call  
my_eventmachine_object.tick in the game loop to have
eventmachine do  
one iteration of it's loop instead of having it loop
constantly. but  
maybe that's the wrong approach.

-- Elliot Temple
http://curi.us/dialogs/


_______________________________________________
Eventmachine-talk mailing list
Eventmachine-talkrubyforge.org
http://rubyforge.org/mailman/listinfo/eventmachine-talk

Re: i wrote a chatroom server
user name
2007-08-27 17:12:51
On 8/27/07, Elliot Temple < curicuri.us">curicuri.us&gt; wrote:
 
I think I'm done working on it now since I don't actually intend to
use it. Any comments on coding style/approach mistakes would still be
appreciated. Also Francis mentioned wanting to have one good chat
server implementation to put in the eventmachine distro, I guess as a
code sample -- if you like mine but there are specific features/
changes it needs to be used I'd be open to adding them.


To add to Elliot';s point: it seems like whenever anyone approaches network programming, the first thing they do is a chat system. It would be really nice to have one in EM. I was actually thinking we might use some code from the various XMPP-on-Ruby projects and build a Jabber server. Any interest?

(I already wrote an event-driven library that can parse protocol data that is composed of XML stanzas, as with XMPP and XACML. Neither REXML nor Ruby/libxml turned out to be capable of this.)

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )