Sha256: 60c9bdc2049d74083f62ab7c42a0a3faf5ea21f30670e20bbc8f8f1472fe538d

Contents?: true

Size: 484 Bytes

Versions: 129

Compression:

Stored size: 484 Bytes

Contents

#!/usr/bin/env ruby

require 'rubygems' # or use Bundler.setup
require 'eventmachine'

class SimpleChatServer < EM::Connection

  #
  # EventMachine handlers
  #

  def post_init
    puts "A client has connected..."
  end

  def unbind
    puts "A client has left..."
  end
end

EventMachine.run do
  # hit Control + C to stop
  Signal.trap("INT")  { EventMachine.stop }
  Signal.trap("TERM") { EventMachine.stop }

  EventMachine.start_server("0.0.0.0", 10000, SimpleChatServer)
end

Version data entries

129 entries across 126 versions & 10 rubygems

Version Path
eventmachine-1.0.0.rc.1-java examples/guides/getting_started/04_simple_chat_server_step_one.rb
eventmachine-1.0.0.rc.1 examples/guides/getting_started/04_simple_chat_server_step_one.rb
eventmachine-with-ipv6-1.0.0.beta.4.ipv6.0 examples/guides/getting_started/04_simple_chat_server_step_one.rb
eventmachine-1.0.0.beta.4.1-x86-mswin32-60 examples/guides/getting_started/04_simple_chat_server_step_one.rb
eventmachine-1.0.0.beta.4.1-x86-mingw32 examples/guides/getting_started/04_simple_chat_server_step_one.rb
eventmachine-1.0.0.beta.4-x86-mswin32-60 examples/guides/getting_started/04_simple_chat_server_step_one.rb
eventmachine-1.0.0.beta.4-x86-mingw32 examples/guides/getting_started/04_simple_chat_server_step_one.rb
eventmachine-1.0.0.beta.4-java examples/guides/getting_started/04_simple_chat_server_step_one.rb
eventmachine-1.0.0.beta.4 examples/guides/getting_started/04_simple_chat_server_step_one.rb