Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to close websocket from the on_message handler #624

Open
AlexandriaOL opened this issue Dec 25, 2021 · 0 comments
Open

Unable to close websocket from the on_message handler #624

AlexandriaOL opened this issue Dec 25, 2021 · 0 comments
Labels

Comments

@AlexandriaOL
Copy link

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
@sdogruyol sdogruyol added the bug label Jan 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants