Unable to close websocket from the on_message handler
AlexandriaOL opened this issue · comments
Description
I am unable to close a socket from the message handler
Steps to Reproduce
require "kemal"
ws "/" do |sock, context|
sock.on_message do |message|
puts message
sock.close HTTP::WebSocket::CloseCode::NormalClosure
end
sock.on_close do
puts "Waah"
end
end
Kemal.run
Expected behavior:
It should close the websocket after a message is recieved
Actual behavior:
The websocket stays open and can continue sending messages
Reproduces how often:
continually
Versions
aster@hephaestus:redacted$ crystal --version
Crystal 1.2.1 [4e6c0f26e] (2021-10-21)
LLVM: 10.0.0
Default target: x86_64-unknown-linux-gnu