16 lines
489 B
Crystal
16 lines
489 B
Crystal
require "ipc"
|
|
require "./colors"
|
|
|
|
IPC::Service.new ("pong") do |event|
|
|
case event
|
|
when IPC::Event::Connection
|
|
puts "#{CBLUE}IPC::Event::Connection#{CRESET}, client: #{event.connection.fd}"
|
|
when IPC::Event::Disconnection
|
|
puts "#{CBLUE}IPC::Event::Disconnection#{CRESET}, client: #{event.connection.fd}"
|
|
when IPC::Event::Message
|
|
puts "#{CGREEN}IPC::Event::Message#{CRESET}, client: #{event.connection.fd}"
|
|
# puts event.message.to_s
|
|
event.connection.send event.message
|
|
end
|
|
end
|