Closed ksimmi closed 2 months ago
Apologies, the example was not updated with a change in the interface, let me fix it.
The examples are updated and they all work now.
In short, previously write
would accept rich values and convert them to JSON, but this was too opinionated. So, we extracted that functionality out. It was pretty convenient, so I might consider how to re-add it in the future.
In first time I catched
NoMethodError: undefined method `generate' for Protocol::WebSocket::TextMessage:Class (NoMethodError)
I fixed it by bundle update.
Thank you.
Hello!
I tried to explore gem with an example and it not working for me. The example contains lines:
But I get an error when I call
connection.write
with Hash argument. I patchedAsync::WebSocket::Connection#write
with breakpoint to debug.My console output:
message.send
expects symbol or string:TypeError: #<Async::WebSocket::Connection:0x00007f493bd4eb18 ... is not a symbol nor a string
If I call
connection.write
with string argument likeconnection.write({user: USER, text: line}.to_json)
it will work. But I don't like this solution because the comment from code above.# This is a compatibility shim for the previous implementation. We may want to eventually deprecate this use case... or maybe it's convenient enough to leave it around.
Ruby 3.2.2