Hello, thank you for all your hard work building out the Async ecosystem for Ruby.
I am looking to set up a minimal UDP server example for myself to try out this gem. Code is as follows:
require "async"
require "io/endpoint/host_endpoint"
endpoint = IO::Endpoint.udp("localhost", 5678)
Async do |task|
endpoint.bind do |socket|
while true
data, _ = socket.recvfrom(1024)
puts data
end
end
end
client = IO::Endpoint.udp("localhost", 5678)
Async do |task|
client.connect do |socket|
10.times do
socket.send("Hello")
end
end
end
When I run this ruby in a file, nothing gets printed and the program hangs.
Likely, I have a misunderstanding of the Async programing model, and I'm doing something obvious that causes this. I tried to copy the udp echo server example from the archived async-io repository relatively faithfully (though not doing an echo of course). In an ideal world, I'd love to build a pure Ruby pub-sub and clustering library so that we wouldn't need to depend on Redis or a DB to back the pub-sub required for ActionCable. If I was ever maimed and couldn't do my day job I'd probably work on this.
Thank you for your time.
Hello, thank you for all your hard work building out the Async ecosystem for Ruby.
I am looking to set up a minimal UDP server example for myself to try out this gem. Code is as follows:
When I run this ruby in a file, nothing gets printed and the program hangs.
Likely, I have a misunderstanding of the Async programing model, and I'm doing something obvious that causes this. I tried to copy the udp echo server example from the archived async-io repository relatively faithfully (though not doing an echo of course). In an ideal world, I'd love to build a pure Ruby pub-sub and clustering library so that we wouldn't need to depend on Redis or a DB to back the pub-sub required for ActionCable. If I was ever maimed and couldn't do my day job I'd probably work on this.
Thank you for your time.