Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eventmachine/eventmachine
EventMachine: fast, simple event-processing library for Ruby programs
https://github.com/eventmachine/eventmachine
Last synced: 3 months ago
JSON representation
EventMachine: fast, simple event-processing library for Ruby programs
- Host: GitHub
- URL: https://github.com/eventmachine/eventmachine
- Owner: eventmachine
- License: other
- Created: 2008-08-17T18:35:57.000Z (over 16 years ago)
- Default Branch: master
- Last Pushed: 2023-07-17T20:23:54.000Z (over 1 year ago)
- Last Synced: 2024-04-21T06:19:19.901Z (9 months ago)
- Language: Ruby
- Homepage:
- Size: 2.46 MB
- Stars: 4,240
- Watchers: 112
- Forks: 632
- Open Issues: 203
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ruby-toolbox - EventMachine - EventMachine implements a fast, single-threaded engine for arbitrary network communications. It's extremely easy to use in Ruby. EventMachine wraps all interactions with IP sockets, allowing programs to concentrate on the implementation of network protocols. It can be used to create both network servers and clients. To create a server or client, a Ruby program only needs to specify the IP address and port, and provide a Module that implements the communications protocol. Implementations of several standard network protocols are provided with the package, primarily to serve as examples. The real goal of EventMachine is to enable programs to easily interface with other programs using TCP/IP, especially if custom protocols are required. (Developer Tools / Concurrent Processing)
- awesome-ruby - EventMachine - An event-driven I/O and lightweight concurrency library for Ruby. (Concurrency and Parallelism)
README
# About EventMachine [![Build Status](https://github.com/eventmachine/eventmachine/actions/workflows/workflow.yml/badge.svg)](https://github.com/eventmachine/eventmachine/actions) [![Code Climate Maintainability](https://api.codeclimate.com/v1/badges/e9b0603462905d5b9118/maintainability)](https://codeclimate.com/github/eventmachine/eventmachine/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](http://en.wikipedia.org/wiki/Reactor_pattern),
much like [JBoss Netty](http://www.jboss.org/netty), [Apache MINA](http://mina.apache.org/),
Python's [Twisted](http://twistedmatrix.com), [Node.js](http://nodejs.org), 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? ##
* Scalable event-driven servers. Examples: [Thin](https://github.com/macournoyer/thin/) or [Goliath](https://github.com/postrank-labs/goliath/).
* Scalable asynchronous clients for various protocols, RESTful APIs and so on. Examples: [em-http-request](https://github.com/igrigorik/em-http-request) or [amqp gem](https://github.com/ruby-amqp/amqp).
* Efficient network proxies with custom logic. Examples: [Proxymachine](https://github.com/mojombo/proxymachine/).
* File and network monitoring tools. Examples: [eventmachine-tail](https://github.com/jordansissel/eventmachine-tail) and [logstash](https://github.com/logstash/logstash).## What platforms are supported by EventMachine? ##
EventMachine supports Ruby 2.0.0 and later (see tested versions at
[.github/workflows/workflow.yml](.github/workflows/workflow.yml)). It runs on 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](https://rubygems.org/)
gem install eventmachine
or add this to your Gemfile if you use [Bundler](http://gembundler.com/):
gem 'eventmachine'
## Getting started ##
For an introduction to EventMachine, check out:
* [blog post about EventMachine by Ilya Grigorik](http://www.igvita.com/2008/05/27/ruby-eventmachine-the-speed-demon/).
* [EventMachine Introductions by Dan Sinclair](http://everburning.com/news/eventmachine-introductions.html).### Server example: Echo server ###
Here's a fully-functional echo server written with EventMachine:
```ruby
require 'eventmachine'module EchoServer
def post_init
puts "-- someone connected to the echo server!"
enddef receive_data data
send_data ">>>you sent: #{data}"
close_connection if data =~ /quit/i
enddef 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](http://rubydoc.info/github/eventmachine/eventmachine/frames) and a [wiki](https://github.com/eventmachine/eventmachine/wiki).
## Community and where to get help ##
* Join the [mailing list](http://groups.google.com/group/eventmachine) (Google Group)
* Join IRC channel #eventmachine on irc.freenode.net## License and copyright ##
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](https://github.com/celluloid/celluloid).