EventMachine

EventMachine:Ruby程序的快速,简单的事件处理库。(EventMachine: fast, simple event-processing library for Ruby programs. )

Github星跟踪图

EventMachine是一个事件驱动的 I/O和Ruby的轻量级并发库。它使用Reactor模式提供事件驱动的 I/O,就像JBoss Netty、Apache MINA、Python的Twisted、Node.js、libevent和libev一样。

EventMachine旨在同时满足两个关键需求:
  • 极高的可扩展性,性能和稳定性,适用于最苛刻的生产环境。
  • 一种API,可消除高性能线程网络编程的复杂性,从而使工程师能够专注于其应用逻辑。
这种独特的组合使EventMachine成为关键网络应用程序的设计人员的首选,包括Web服务器和代理、电子邮件和IM生产系统、身份验证/授权处理器等。
EventMachine自21世纪初以来,一直是一个成熟且经过考验的库。
EventMachine适合用来做什么?
EventMachine支持哪些平台?

EventMachine支持Ruby 1.8.7到2.3,REE,JRuby,并且在Windows以及Unix系列的许多操作系统(Linux,Mac OS X,BSD风格)中都可以使用。

EventMachine根据GPL或Ruby许可证的条款发布。

主要指标

概览
名称与所有者eventmachine/eventmachine
主编程语言Ruby
编程语言Ruby (语言数: 5)
平台
许可证Other
所有者活动
创建于2008-08-17 18:35:57
推送于2024-09-16 19:37:10
最后一次提交2024-09-16 15:37:09
发布数33
最新版本名称v1.2.7 (发布于 )
第一版名称v0.12.4 (发布于 )
用户参与
星数4.3k
关注者数109
派生数629
提交数1.4k
已启用问题?
问题数646
打开的问题数175
拉请求数246
打开的拉请求数32
关闭的拉请求数93
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?

About EventMachine Build Status Code Climate Maintainability

What is EventMachine

EventMachine is an event-driven I/O and lightweight concurrency library for Ruby.
It provides event-driven I/O using the Reactor pattern,
much like JBoss Netty, Apache MINA,
Python's Twisted, Node.js, libevent and libev.

EventMachine is designed to simultaneously meet two key needs:

  • Extremely high scalability, performance and stability for the most demanding production environments.
  • An API that eliminates the complexities of high-performance threaded network programming,
    allowing engineers to concentrate on their application logic.

This unique combination makes EventMachine a premier choice for designers of critical networked
applications, including Web servers and proxies, email and IM production systems, authentication/authorization
processors, and many more.

EventMachine has been around since the early 2000s and is a mature and battle-tested library.

What EventMachine is good for?

What platforms are supported by EventMachine?

EventMachine supports Ruby 2.0.0 through 2.6, JRuby and works well on Windows as well
as many operating systems from the Unix family (Linux, Mac OS X, BSD flavors).

Install the gem

Install it with RubyGems

gem install eventmachine

or add this to your Gemfile if you use Bundler:

gem 'eventmachine'

Getting started

For an introduction to EventMachine, check out:

Server example: Echo server

Here's a fully-functional echo server written with EventMachine:

 require 'eventmachine'

 module EchoServer
   def post_init
     puts "-- someone connected to the echo server!"
   end

   def receive_data data
     send_data ">>>you sent: #{data}"
     close_connection if data =~ /quit/i
   end

   def unbind
     puts "-- someone disconnected from the echo server!"
   end
end

# Note that this will block current thread.
EventMachine.run {
  EventMachine.start_server "127.0.0.1", 8081, EchoServer
}

EventMachine documentation

Currently we only have reference documentation and a wiki.

Community and where to get help

  • Join the mailing list (Google Group)
  • Join IRC channel #eventmachine on irc.freenode.net

EventMachine is copyrighted free software made available under the terms
of either the GPL or Ruby's License.

Copyright: (C) 2006-07 by Francis Cianfrocca. All Rights Reserved.

Alternatives

If you are unhappy with EventMachine and want to use Ruby, check out Celluloid.