EventMachine

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

Github stars Tracking Chart

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许可证的条款发布。

Main metrics

Overview
Name With Ownereventmachine/eventmachine
Primary LanguageRuby
Program languageRuby (Language Count: 5)
Platform
License:Other
所有者活动
Created At2008-08-17 18:35:57
Pushed At2024-09-16 19:37:10
Last Commit At2024-09-16 15:37:09
Release Count33
Last Release Namev1.2.7 (Posted on )
First Release Namev0.12.4 (Posted on )
用户参与
Stargazers Count4.3k
Watchers Count109
Fork Count629
Commits Count1.4k
Has Issues Enabled
Issues Count646
Issue Open Count175
Pull Requests Count246
Pull Requests Open Count32
Pull Requests Close Count93
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private

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.