cool.io - cool event driven programming for Ruby
It seems like there is a common pattern with many libraries: You have your full stack solution, and then you have your lean and mean one. Ruby on Rails has its counterpart in Sinatra, for example. So what about event-driven programming frameworks, like EventMachine or Node.js?
Enter cool.io:
require 'rubygems' require 'cool.io' ADDR = '127.0.0.1' PORT = 4321 cool.io.server ADDR, PORT do on_connect do puts "#{remote_addr}:#{remote_port} connected" end on_close do puts "#{remote_addr}:#{remote_port} disconnected" end on_read do |data| write data end end puts "Echo server listening on #{ADDR}:#{PORT}" cool.io.runPretty cool. Cool.io is trying to make evented programming really easy, which is good, because this style of programming is a bit different than your usual kinds of web programming.
Under the hood, Cool.io is built on top of
libev, which hooks it up to various system calls on different operating systems for doing this kind of thing in a blazing fast manner. Then again, my OS developer buddies would kill me for calling a system call ‘performant,’ but that’s a different story… what it boils down to is that Cool.io doesn’t reinvent the wheel: epoll on Linux, kqueue on BSD and OSX…Personally, I’ve been meaning to write some software in the evented style, but I haven’t had the time to appropriately level up my Javascript skills yet. Cool.io just might be the ticket to building something more than just a toy example or two.
-
jm3 liked this
-
jm3 reblogged this from thechangelog
-
reparatiifrigidere liked this
-
last--minute liked this
-
elv1s liked this
-
dentarg liked this
-
sanemat reblogged this from iorionda
-
iorionda reblogged this from thechangelog
-
oivoodoo liked this
-
polyacr liked this
-
fareastside liked this
-
justinherrick liked this
-
justinherrick reblogged this from thechangelog
-
thechangelog posted this