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
發布數33
最新版本名稱v1.2.7 (發布於 )
第一版名稱v0.12.4 (發布於 )
創建於2008-08-17 18:35:57
推送於2023-07-17 20:23:54
最后一次提交2023-07-17 22:23:54
星數4.2k
關注者數112
派生數631
提交數1.3k
已啟用問題?
問題數633
打開的問題數168
拉請求數224
打開的拉請求數35
關閉的拉請求數91
已啟用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.

去到頂部