You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But I get an error when I call connection.write with Hash argument. I patched Async::WebSocket::Connection#write with breakpoint to debug.
class Async::WebSocket::Connection # < ::Protocol::WebSocket::Connection
def write(message, **options)
# 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.
if message.is_a?(String)
if message.encoding == Encoding::UTF_8
return send_text(message, **options)
else
return send_binary(message, **options)
end
end
binding.pry # breakpoint
message.send(self, **options)
end
end
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 like connection.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
The text was updated successfully, but these errors were encountered:
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.
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
The text was updated successfully, but these errors were encountered: