From: Francis Cianfrocca Date: 2009-05-19T01:30:37+09:00 Subject: Re: EventMachine or GServer? --001485f1dc9635a2e6046a32504f Content-Type: text/plain; charset=ISO-8859-13 Content-Transfer-Encoding: quoted-printable On Mon, May 18, 2009 at 7:42 AM, Chuck Remes wrote= : > > On May 17, 2009, at 5:34 PM, Art=FBras =D0lajus wrote: > > Hm, the EM implementation... >> >> module GameServer >> def post_init >> puts "Registering #{self} to Dispatcher." >> Dispatcher.singleton.register self >> end >> >> def receive_data(data) >> Dispatcher.singleton.receive self, JSON.load(data) if data !=3D "" >> rescue JSON::ParserError >> send_data "Unknown protocol, aborting.\n" >> close_connection_after_writing >> end >> >> def send_message(message) >> send_data "%s\n" % JSON.dump(message) >> end >> >> def unbind >> Dispatcher.singleton.unregister self >> end >> end >> >> So I guess EM handles loads better (as it's C) and is easier to use? >> > > EM is certainly very fast but I don't know if it is easier to use. The > documentation is hard to understand and the examples are all so simplisti= c > it is often difficult to see how to write a complex client or server. > > I suggest downloading projects that have used EM (like Thin) and learning > good techniques from that code. > > cr > > > > I'd be very open to hearing suggestions on how to improve the EM documentation. Feel free to email me directly. --001485f1dc9635a2e6046a32504f--