Files
news.gitea.happylizard.me/bin/gems/em-websocket-0.5.3/examples/echo.rb
T
pizza2d1 4cee170d66
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 9s
Add bin and edit workflow
2026-09-16 13:11:16 -06:00

25 lines
545 B
Ruby

require File.expand_path('../../lib/em-websocket', __FILE__)
EM.run {
EM::WebSocket.run(:host => "0.0.0.0", :port => 8080, :debug => false) do |ws|
ws.onopen { |handshake|
puts "WebSocket opened #{{
:path => handshake.path,
:query => handshake.query,
:origin => handshake.origin,
}}"
ws.send "Hello Client!"
}
ws.onmessage { |msg|
ws.send "Pong: #{msg}"
}
ws.onclose {
puts "WebSocket closed"
}
ws.onerror { |e|
puts "Error: #{e.message}"
}
end
}