Closed adenta closed 14 hours ago
Okay, I'll take a look.
Protocol::WebSocket::TextMessage.generate("my_command").buffer
# => "\"my_command\""
This generates JSON quoted messages which may not be what you want, as in the faye example you are using a custom coder/format.
Replacing TextMessage.generate
with TextMessage.new
seems to fix the issue.
I advise you to use JSON or some other standard message format as it will ultimately make your life a lot easier, if you are in control of both the client and server.
I put together a repository here, where I create the same functionality in Faye and Async. When I run faye my console reads:
and when I run async my console reads:
Notice the missing room error message in the async code:
|pm|!async-ruby|~|/error /choose - must be used in a chat room, not a console
. For some reason, the room isnt getting sent in async, where it is getting sent in faye. I'm kinda stumped, because if you look at the command I am sending with faye and async, its the same command:~~~COMMAND_TO_SEND~~~: battle-gen9randombattle-2234459339|/choose default
~~~COMMAND_TO_SEND~~~: battle-gen9randombattle-2234455557|/choose default
If there is anything else I can do to help you help me let me know, super curious whats up here.