Issue with Socket IO on Windows

Hi there,

I try to use socket IO on Windows:

require "http/web_socket"
socket = HTTP::WebSocket.new("ws://127.0.0.1:3000/asdf")

socket.on_binary do |msg|
  puts "on_binary"
end

socket.on_message do |msg|
  puts "on_message"
end

socket.on_close do
end

f1 = spawn do
  puts "on_fiber_f1"
  socket.send "Hello"
end

socket.run

After executing socket.run, if no data is sent from the server, reading data from the socket should be blocked, and then the scheduler should resume fiber f1. It works on Linux, but not work as expected on Windows, the f1 does not execute.

Did i misunderstand something? Thanks.

Fibers are not implemented at all on Windows, so only one of the two branches in this code ever gets to run.

Fibers actually are implemented. The event loop is missing.

1 Like