socketry / async-websocket

Asynchronous WebSocket client and server, supporting HTTP/1 and HTTP/2 for Ruby.
MIT License
173 stars 17 forks source link

difference in behavior between Faye and Async #76

Closed adenta closed 14 hours ago

adenta commented 17 hours ago

I put together a repository here, where I create the same functionality in Faye and Async. When I run faye my console reads:

➜  wss-demo git:(main) ruby main.rb
Connected to Pokemon Showdown WebSocket
|updateuser| Guest 2584559|0|102|{"blockChallenges":false,"blockPMs":false,"ignoreTickets":false,"hideBattlesFromTrainerCard":false,"blockInvites":false,"doNotDisturb":false,"blockFriendRequests":false,"allowFriendNotifications":false,"displayBattlesToFriends":false,"hideLogins":false,"hiddenNextBattle":false,"inviteOnlyNextBattle":false,"language":null}
|formats|,1|S/V Singles|[Gen 9] Random Battle,f|[Gen 9] Unrated Random Battle,b|[Gen 9] Free-For-All Random Battle,7|[Gen 9] Random Battle (Blitz),f|[Gen 9] Multi Random Battle,5|[Gen 9] OU,e|[Gen 9] Ubers,e|[Gen 9] UU,e|[Gen 9] RU,e|[Gen 9] NU,e|[Gen 9] PU,e|[Gen 9] LC,e|[Gen 9] Monotype,e|[Gen 9] CAP,e|[Gen 9] BSS Reg G,5c|[Gen 9] BSS Reg H,5e|[Gen 9] Custom Game,c|,1|S/V Doubles|[Gen 9] Random Doubles Battle,f|[Gen 9] Doubles OU,e|[Gen 9] Doubles Ubers,e|[Gen 9] Doubles UU,e|[Gen 9] Doubles LC,c|[Gen 9] VGC 2023 Reg D,5c|[Gen 9] VGC 2024 Reg G,5c|[Gen 9] VGC 2024 Reg H,5e|[Gen 9] VGC 2024 Reg H (Bo3),1a|[Gen 9] Doubles Custom Game,c|,1|Unofficial Metagames|[Gen 9] 1v1,e|[Gen 9] 2v2 Doubles,e|[Gen 9] Anything Goes,e|[Gen 9] Ubers UU,e|[Gen 9] ZU,e|[Gen 9] Free-For-All,6|[Gen 9] LC UU,c|[Gen 9] NFE,c|,1|Pet Mods|[Gen 6] Megas Revisited,e|[Gen 1] RBY CAP,e|,1|Draft|[Gen 9] Draft,8c|[Gen 9] 6v6 Doubles Draft,8c|[Gen 9] 4v4 Doubles Draft,dc|[Gen 9] NatDex Draft,8c|[Gen 9] NatDex 6v6 Doubles Draft,8c|[Gen 9] NatDex LC Draft,8c|[Gen 8] Galar Dex Draft,c|[Gen 8] NatDex Draft,c|[Gen 8] NatDex 4v4 Doubles Draft,1c|[Gen 7] Draft,c|[Gen 6] Draft,c|[Gen 3] Draft,c|,2|OM of the Month|[Gen 9] Convergence,e|[Gen 9] Inverse,e|[Gen 9] Inheritance,e|,2|Other Metagames|[Gen 9] Almost Any Ability,e|[Gen 9] Balanced Hackmons,e|[Gen 9] Godly Gift,e|[Gen 9] Mix and Mega,e|[Gen 9] Partners in Crime,e|[Gen 9] Shared Power,e|[Gen 9] STABmons,e|[Gen 7] Pure Hackmons,e|,2|Challengeable OMs|[Gen 9] 350 Cup,c|[Gen 9] Camomons,c|[Gen 9] Category Swap,c|[Gen 9] Cross Evolution,c|[Gen 9] Fervent Impersonation,c|[Gen 9] Foresighters,c|[Gen 9] Fortemons,c|[Gen 9] Frantic Fusions,c|[Gen 9] Full Potential,c|[Gen 9] Passive Aggressive,c|[Gen 9] Pokebilities,c|[Gen 9] Pokemoves,c|[Gen 9] Pure Hackmons,c|[Gen 9] Revelationmons,c|[Gen 9] Sharing is Caring,c|[Gen 9] Tera Donation,c|[Gen 9] The Card Game,c|[Gen 9] The Loser's Game,c|[Gen 9] Trademarked,c|[Gen 9] Triples,c|[Gen 9] Type Split,c|[Gen 6] Pure Hackmons,c|,2|National Dex|[Gen 9] National Dex,e|[Gen 8] National Dex,e|,2|National Dex Other Tiers|[Gen 9] National Dex 35 Pokes,e|[Gen 9] National Dex Ubers,e|[Gen 9] National Dex UU,e|[Gen 9] National Dex RU,c|[Gen 9] National Dex LC,c|[Gen 9] National Dex Monotype,e|[Gen 9] National Dex Doubles,e|[Gen 9] National Dex Doubles Ubers,c|[Gen 9] National Dex Ubers UU,c|[Gen 9] National Dex AG,c|[Gen 9] National Dex BH,c|[Gen 8] National Dex UU,c|[Gen 8] National Dex Monotype,c|,3|Randomized Format Spotlight|[Gen 9] Random Battle (Shared Power, B12P6),f|,3|Randomized Metas|[Gen 9] Random Roulette,d|[Gen 9] Super Staff Bros Ultimate,f|[Gen 9] Monotype Random Battle,f|[Gen 9] Random Battle Mayhem,f|[Gen 9] BSS Factory,1f|[Gen 9] Baby Random Battle,f|[Gen 9] Computer-Generated Teams,f|[Gen 9] Hackmons Cup,f|[Gen 9] Doubles Hackmons Cup,d|[Gen 9] Broken Cup,d|[Gen 9] Challenge Cup 1v1,f|[Gen 9] Challenge Cup 2v2,f|[Gen 9] Challenge Cup 6v6,d|[Gen 9] Metronome Battle,e|[Gen 8] Random Battle,f|[Gen 8] Random Doubles Battle,f|[Gen 8] Free-For-All Random Battle,7|[Gen 8] Multi Random Battle,5|[Gen 8] Battle Factory,f|[Gen 8] BSS Factory,1d|[Gen 8] Hackmons Cup,f|[Gen 8] Metronome Battle,c|[Gen 8] CAP 1v1,d|[Gen 8 BDSP] Random Battle,d|[Gen 7] Random Battle,f|[Gen 7] Battle Factory,f|[Gen 7] BSS Factory,1d|[Gen 7] Hackmons Cup,d|[Gen 7 Let's Go] Random Battle,d|[Gen 6] Random Battle,f|[Gen 6] Battle Factory,9|[Gen 5] Random Battle,f|[Gen 4] Random Battle,f|[Gen 3] Random Battle,f|[Gen 2] Random Battle,f|[Gen 1] Random Battle,f|[Gen 1] Challenge Cup,9|[Gen 1] Hackmons Cup,9|,4|RoA Spotlight|[Gen 3] Ubers,e|[Gen 5] PU,e|[Gen 4] ZU,e|,4|Past Gens OU|[Gen 8] OU,e|[Gen 7] OU,e|[Gen 6] OU,e|[Gen 5] OU,e|[Gen 4] OU,e|[Gen 3] OU,e|[Gen 2] OU,e|[Gen 1] OU,e|,4|Past Gens Doubles OU|[Gen 8] Doubles OU,e|[Gen 7] Doubles OU,e|[Gen 6] Doubles OU,e|[Gen 5] Doubles OU,c|[Gen 4] Doubles OU,c|[Gen 3] Doubles OU,c|,4|Sw/Sh Singles|[Gen 8] Ubers,c|[Gen 8] UU,c|[Gen 8] RU,c|[Gen 8] NU,c|[Gen 8] PU,c|[Gen 8] LC,c|[Gen 8] Monotype,c|[Gen 8] 1v1,c|[Gen 8] Anything Goes,c|[Gen 8] ZU,c|[Gen 8] CAP,c|[Gen 8] Battle Stadium Singles,5c|[Gen 8 BDSP] OU,c|[Gen 8 BDSP] Ubers,c|[Gen 8] Custom Game,c|,4|Sw/Sh Doubles|[Gen 8] Doubles Ubers,c|[Gen 8] Doubles UU,c|[Gen 8] VGC 2022,5c|[Gen 8] VGC 2021,5c|[Gen 8] VGC 2020,5c|[Gen 8 BDSP] Doubles OU,c|[Gen 8 BDSP] Battle Festival Doubles,1c|[Gen 8] Doubles Custom Game,c|,4|US/UM Singles|[Gen 7] Ubers,c|[Gen 7] UU,c|[Gen 7] RU,c|[Gen 7] NU,c|[Gen 7] PU,c|[Gen 7] LC,c|[Gen 7] Monotype,c|[Gen 7] 1v1,c|[Gen 7] Anything Goes,c|[Gen 7] ZU,c|[Gen 7] CAP,c|[Gen 7] Battle Spot Singles,5c|[Gen 7 Let's Go] OU,1c|[Gen 7] Custom Game,c|,4|US/UM Doubles|[Gen 7] Doubles UU,c|[Gen 7] VGC 2019,5c|[Gen 7] VGC 2018,5c|[Gen 7] VGC 2017,5c|[Gen 7] Battle Spot Doubles,5c|[Gen 7 Let's Go] Doubles OU,1c|[Gen 7] Doubles Custom Game,c|,4|OR/AS Singles|[Gen 6] Ubers,c|[Gen 6] UU,c|[Gen 6] RU,c|[Gen 6] NU,c|[Gen 6] PU,c|[Gen 6] LC,c|[Gen 6] Monotype,c|[Gen 6] 1v1,c|[Gen 6] Anything Goes,c|[Gen 6] ZU,c|[Gen 6] CAP,c|[Gen 6] Battle Spot Singles,5c|[Gen 6] Custom Game,c|,4|OR/AS Doubles/Triples|[Gen 6] VGC 2016,5c|[Gen 6] VGC 2015,5c|[Gen 6] VGC 2014,5c|[Gen 6] Battle Spot Doubles,5c|[Gen 6] Doubles Custom Game,c|[Gen 6] Battle Spot Triples,1c|[Gen 6] Triples Custom Game,c|,4|B2/W2 Singles|[Gen 5] Ubers,c|[Gen 5] UU,c|[Gen 5] RU,c|[Gen 5] NU,c|[Gen 5] LC,c|[Gen 5] Monotype,c|[Gen 5] 1v1,c|[Gen 5] ZU,c|[Gen 5] CAP,c|[Gen 5] BW1 OU,c|[Gen 5] GBU Singles,5c|[Gen 5] Custom Game,c|,4|B2/W2 Doubles|[Gen 5] VGC 2013,5c|[Gen 5] VGC 2012,5c|[Gen 5] VGC 2011,5c|[Gen 5] Doubles Custom Game,c|[Gen 5] Triples Custom Game,c|,4|DPP Singles|[Gen 4] Ubers,c|[Gen 4] UU,c|[Gen 4] NU,c|[Gen 4] PU,c|[Gen 4] LC,c|[Gen 4] Anything Goes,c|[Gen 4] 1v1,c|[Gen 4] CAP,c|[Gen 4] Custom Game,c|,4|DPP Doubles|[Gen 4] VGC 2010,1c|[Gen 4] VGC 2009,1c|[Gen 4] Doubles Custom Game,c|,4|Past Generations|[Gen 3] UU,c|[Gen 3] RU,c|[Gen 3] NU,c|[Gen 3] PU,c|[Gen 3] LC,c|[Gen 3] 1v1,c|[Gen 3] ZU,c|[Gen 3] Custom Game,c|[Gen 3] Doubles Custom Game,c|[Gen 2] Ubers,c|[Gen 2] UU,c|[Gen 2] NU,c|[Gen 2] PU,c|[Gen 2] 1v1,c|[Gen 2] ZU,c|[Gen 2] NC 2000,c|[Gen 2] Stadium OU,c|[Gen 2] Custom Game,c|[Gen 1] Ubers,c|[Gen 1] UU,c|[Gen 1] NU,c|[Gen 1] PU,c|[Gen 1] 1v1,c|[Gen 1] ZU,c|[Gen 1] Japanese OU,c|[Gen 1] Stadium OU,c|[Gen 1] Tradebacks OU,c|[Gen 1] NC 1997,c|[Gen 1] Custom Game,c
Logged in as asyncruby
|updatesearch|{"searching":[],"games":null}
|updateuser| async-ruby|1|101|{"blockChallenges":false,"blockPMs":false,"ignoreTickets":false,"hideBattlesFromTrainerCard":false,"blockInvites":false,"doNotDisturb":false,"blockFriendRequests":false,"allowFriendNotifications":false,"displayBattlesToFriends":false,"hideLogins":false,"hiddenNextBattle":false,"inviteOnlyNextBattle":false,"language":null}
|updatesearch|{"searching":[],"games":null}
|updatesearch|{"searching":["gen9randombattle"],"games":null}
|updatesearch|{"searching":[],"games":null}
|updatesearch|{"searching":[],"games":{"battle-gen9randombattle-2234459339":"[Gen 9] Random Battle*"}}
|updatesearch|{"searching":[],"games":{"battle-gen9randombattle-2234459339":"[Gen 9] Random Battle*"}}
>battle-gen9randombattle-2234459339
|init|battle
|title|Patu22 vs. async-ruby
|j|☆Patu22
|j|☆async-ruby
>battle-gen9randombattle-2234459339
|request|
>battle-gen9randombattle-2234459339
|t:|1730341181
|gametype|singles
>battle-gen9randombattle-2234459339
|player|p1|Patu22|2|1025
>battle-gen9randombattle-2234459339
|request|{"active":[{"moves":[{"move":"Triple Axel","id":"tripleaxel","pp":16,"maxpp":16,"target":"normal","disabled":false},{"move":"Flower Trick","id":"flowertrick","pp":16,"maxpp":16,"target":"normal","disabled":false},{"move":"Toxic Spikes","id":"toxicspikes","pp":32,"maxpp":32,"target":"foeSide","disabled":false},{"move":"Knock Off","id":"knockoff","pp":32,"maxpp":32,"target":"normal","disabled":false}],"canTerastallize":"Dark"}],"side":{"name":"async-ruby","id":"p2","pokemon":[{"ident":"p2: Meowscarada","details":"Meowscarada, L78, M","condition":"247/247","active":true,"stats":{"atk":217,"def":154,"spa":171,"spd":154,"spe":237},"moves":["tripleaxel","flowertrick","toxicspikes","knockoff"],"baseAbility":"protean","item":"focussash","pokeball":"pokeball","ability":"protean","commanding":false,"reviving":false,"teraType":"Dark","terastallized":""},{"ident":"p2: Quaquaval","details":"Quaquaval, L79, M","condition":"264/264","active":false,"stats":{"atk":235,"def":172,"spa":180,"spd":164,"spe":180},"moves":["closecombat","roost","aquastep","swordsdance"],"baseAbility":"moxie","item":"lifeorb","pokeball":"pokeball","ability":"moxie","commanding":false,"reviving":false,"teraType":"Fighting","terastallized":""},{"ident":"p2: Sceptile","details":"Sceptile, L87, M","condition":"264/264","active":false,"stats":{"atk":198,"def":163,"spa":232,"spd":198,"spe":259},"moves":["rockslide","focusblast","gigadrain","earthquake"],"baseAbility":"overgrow","item":"lifeorb","pokeball":"pokeball","ability":"overgrow","commanding":false,"reviving":false,"teraType":"Ground","terastallized":""},{"ident":"p2: Sandaconda","details":"Sandaconda, L84, F","condition":"258/258","active":false,"stats":{"atk":228,"def":258,"spa":157,"spd":166,"spe":167},"moves":["stealthrock","rest","earthquake","stoneedge"],"baseAbility":"shedskin","item":"leftovers","pokeball":"pokeball","ability":"shedskin","commanding":false,"reviving":false,"teraType":"Dragon","terastallized":""},{"ident":"p2: Hatterene","details":"Hatterene, L85, F","condition":"236/236","active":false,"stats":{"atk":158,"def":210,"spa":280,"spd":224,"spe":98},"moves":["calmmind","mysticalfire","psychic","drainingkiss"],"baseAbility":"magicbounce","item":"leftovers","pokeball":"pokeball","ability":"magicbounce","commanding":false,"reviving":false,"teraType":"Fairy","terastallized":""},{"ident":"p2: Chimecho","details":"Chimecho, L94, M","condition":"293/293","active":false,"stats":{"atk":147,"def":204,"spa":232,"spd":223,"spe":176},"moves":["recover","knockoff","thunderwave","psychicnoise"],"baseAbility":"levitate","item":"leftovers","pokeball":"pokeball","ability":"levitate","commanding":false,"reviving":false,"teraType":"Poison","terastallized":""}]},"rqid":3}
>battle-gen9randombattle-2234459339
|player|p2|async-ruby|101|1040
|teamsize|p1|6
|teamsize|p2|6
|gen|9
|tier|[Gen 9] Random Battle
|rated|
|rule|Species Clause: Limit one of each Pokémon
|rule|HP Percentage Mod: HP is shown in percentages
|rule|Sleep Clause Mod: Limit one foe put to sleep
|rule|Illusion Level Mod: Illusion disguises the Pokémon's true level
|
|t:|1730341181
|start
|switch|p1a: Meowstic|Meowstic-F, L89, F|100/100
|switch|p2a: Meowscarada|Meowscarada, L78, M|247/247
|turn|1
~~~COMMAND_TO_SEND~~~: battle-gen9randombattle-2234459339|/choose default
~~~COMMAND_TO_SEND~~~: battle-gen9randombattle-2234459339|/choose default
~~~COMMAND_TO_SEND~~~: battle-gen9randombattle-2234459339|/choose default
~~~COMMAND_TO_SEND~~~: battle-gen9randombattle-2234459339|/choose default
>battle-gen9randombattle-2234459339
|request|{"active":[{"moves":[{"move":"Triple Axel","id":"tripleaxel","pp":15,"maxpp":16,"target":"normal","disabled":false},{"move":"Flower Trick","id":"flowertrick","pp":16,"maxpp":16,"target":"normal","disabled":false},{"move":"Toxic Spikes","id":"toxicspikes","pp":32,"maxpp":32,"target":"foeSide","disabled":false},{"move":"Knock Off","id":"knockoff","pp":32,"maxpp":32,"target":"normal","disabled":false}],"canTerastallize":"Dark"}],"side":{"name":"async-ruby","id":"p2","pokemon":[{"ident":"p2: Meowscarada","details":"Meowscarada, L78, M","condition":"157/247","active":true,"stats":{"atk":217,"def":154,"spa":171,"spd":154,"spe":237},"moves":["tripleaxel","flowertrick","toxicspikes","knockoff"],"baseAbility":"protean","item":"focussash","pokeball":"pokeball","ability":"protean","commanding":false,"reviving":false,"teraType":"Dark","terastallized":""},{"ident":"p2: Quaquaval","details":"Quaquaval, L79, M","condition":"264/264","active":false,"stats":{"atk":235,"def":172,"spa":180,"spd":164,"spe":180},"moves":["closecombat","roost","aquastep","swordsdance"],"baseAbility":"moxie","item":"lifeorb","pokeball":"pokeball","ability":"moxie","commanding":false,"reviving":false,"teraType":"Fighting","terastallized":""},{"ident":"p2: Sceptile","details":"Sceptile, L87, M","condition":"264/264","active":false,"stats":{"atk":198,"def":163,"spa":232,"spd":198,"spe":259},"moves":["rockslide","focusblast","gigadrain","earthquake"],"baseAbility":"overgrow","item":"lifeorb","pokeball":"pokeball","ability":"overgrow","commanding":false,"reviving":false,"teraType":"Ground","terastallized":""},{"ident":"p2: Sandaconda","details":"Sandaconda, L84, F","condition":"258/258","active":false,"stats":{"atk":228,"def":258,"spa":157,"spd":166,"spe":167},"moves":["stealthrock","rest","earthquake","stoneedge"],"baseAbility":"shedskin","item":"leftovers","pokeball":"pokeball","ability":"shedskin","commanding":false,"reviving":false,"teraType":"Dragon","terastallized":""},{"ident":"p2: Hatterene","details":"Hatterene, L85, F","condition":"236/236","active":false,"stats":{"atk":158,"def":210,"spa":280,"spd":224,"spe":98},"moves":["calmmind","mysticalfire","psychic","drainingkiss"],"baseAbility":"magicbounce","item":"leftovers","pokeball":"pokeball","ability":"magicbounce","commanding":false,"reviving":false,"teraType":"Fairy","terastallized":""},{"ident":"p2: Chimecho","details":"Chimecho, L94, M","condition":"293/293","active":false,"stats":{"atk":147,"def":204,"spa":232,"spd":223,"spe":176},"moves":["recover","knockoff","thunderwave","psychicnoise"],"baseAbility":"levitate","item":"leftovers","pokeball":"pokeball","ability":"levitate","commanding":false,"reviving":false,"teraType":"Poison","terastallized":""}]},"rqid":5}
>battle-gen9randombattle-2234459339
|
|t:|1730341201
|move|p2a: Meowscarada|Triple Axel|p1a: Meowstic
|-start|p2a: Meowscarada|typechange|Ice|[from] ability: Protean
|-crit|p1a: Meowstic
|-damage|p1a: Meowstic|88/100
|-hitcount|p1a: Meowstic|1
|move|p1a: Meowstic|Alluring Voice|p2a: Meowscarada
|-damage|p2a: Meowscarada|157/247
|-damage|p1a: Meowstic|78/100|[from] item: Life Orb
|
|upkeep
|turn|2
~~~COMMAND_TO_SEND~~~: battle-gen9randombattle-2234459339|/choose default

and when I run async my console reads:

➜  wss-demo git:(main) ruby main.rb
|updateuser| Guest 2580435|0|2|{"blockChallenges":false,"blockPMs":false,"ignoreTickets":false,"hideBattlesFromTrainerCard":false,"blockInvites":false,"doNotDisturb":false,"blockFriendRequests":false,"allowFriendNotifications":false,"displayBattlesToFriends":false,"hideLogins":false,"hiddenNextBattle":false,"inviteOnlyNextBattle":false,"language":null}
|formats|,1|S/V Singles|[Gen 9] Random Battle,f|[Gen 9] Unrated Random Battle,b|[Gen 9] Free-For-All Random Battle,7|[Gen 9] Random Battle (Blitz),f|[Gen 9] Multi Random Battle,5|[Gen 9] OU,e|[Gen 9] Ubers,e|[Gen 9] UU,e|[Gen 9] RU,e|[Gen 9] NU,e|[Gen 9] PU,e|[Gen 9] LC,e|[Gen 9] Monotype,e|[Gen 9] CAP,e|[Gen 9] BSS Reg G,5c|[Gen 9] BSS Reg H,5e|[Gen 9] Custom Game,c|,1|S/V Doubles|[Gen 9] Random Doubles Battle,f|[Gen 9] Doubles OU,e|[Gen 9] Doubles Ubers,e|[Gen 9] Doubles UU,e|[Gen 9] Doubles LC,c|[Gen 9] VGC 2023 Reg D,5c|[Gen 9] VGC 2024 Reg G,5c|[Gen 9] VGC 2024 Reg H,5e|[Gen 9] VGC 2024 Reg H (Bo3),1a|[Gen 9] Doubles Custom Game,c|,1|Unofficial Metagames|[Gen 9] 1v1,e|[Gen 9] 2v2 Doubles,e|[Gen 9] Anything Goes,e|[Gen 9] Ubers UU,e|[Gen 9] ZU,e|[Gen 9] Free-For-All,6|[Gen 9] LC UU,c|[Gen 9] NFE,c|,1|Pet Mods|[Gen 6] Megas Revisited,e|[Gen 1] RBY CAP,e|,1|Draft|[Gen 9] Draft,8c|[Gen 9] 6v6 Doubles Draft,8c|[Gen 9] 4v4 Doubles Draft,dc|[Gen 9] NatDex Draft,8c|[Gen 9] NatDex 6v6 Doubles Draft,8c|[Gen 9] NatDex LC Draft,8c|[Gen 8] Galar Dex Draft,c|[Gen 8] NatDex Draft,c|[Gen 8] NatDex 4v4 Doubles Draft,1c|[Gen 7] Draft,c|[Gen 6] Draft,c|[Gen 3] Draft,c|,2|OM of the Month|[Gen 9] Convergence,e|[Gen 9] Inverse,e|[Gen 9] Inheritance,e|,2|Other Metagames|[Gen 9] Almost Any Ability,e|[Gen 9] Balanced Hackmons,e|[Gen 9] Godly Gift,e|[Gen 9] Mix and Mega,e|[Gen 9] Partners in Crime,e|[Gen 9] Shared Power,e|[Gen 9] STABmons,e|[Gen 7] Pure Hackmons,e|,2|Challengeable OMs|[Gen 9] 350 Cup,c|[Gen 9] Camomons,c|[Gen 9] Category Swap,c|[Gen 9] Cross Evolution,c|[Gen 9] Fervent Impersonation,c|[Gen 9] Foresighters,c|[Gen 9] Fortemons,c|[Gen 9] Frantic Fusions,c|[Gen 9] Full Potential,c|[Gen 9] Passive Aggressive,c|[Gen 9] Pokebilities,c|[Gen 9] Pokemoves,c|[Gen 9] Pure Hackmons,c|[Gen 9] Revelationmons,c|[Gen 9] Sharing is Caring,c|[Gen 9] Tera Donation,c|[Gen 9] The Card Game,c|[Gen 9] The Loser's Game,c|[Gen 9] Trademarked,c|[Gen 9] Triples,c|[Gen 9] Type Split,c|[Gen 6] Pure Hackmons,c|,2|National Dex|[Gen 9] National Dex,e|[Gen 8] National Dex,e|,2|National Dex Other Tiers|[Gen 9] National Dex 35 Pokes,e|[Gen 9] National Dex Ubers,e|[Gen 9] National Dex UU,e|[Gen 9] National Dex RU,c|[Gen 9] National Dex LC,c|[Gen 9] National Dex Monotype,e|[Gen 9] National Dex Doubles,e|[Gen 9] National Dex Doubles Ubers,c|[Gen 9] National Dex Ubers UU,c|[Gen 9] National Dex AG,c|[Gen 9] National Dex BH,c|[Gen 8] National Dex UU,c|[Gen 8] National Dex Monotype,c|,3|Randomized Format Spotlight|[Gen 9] Random Battle (Shared Power, B12P6),f|,3|Randomized Metas|[Gen 9] Random Roulette,d|[Gen 9] Super Staff Bros Ultimate,f|[Gen 9] Monotype Random Battle,f|[Gen 9] Random Battle Mayhem,f|[Gen 9] BSS Factory,1f|[Gen 9] Baby Random Battle,f|[Gen 9] Computer-Generated Teams,f|[Gen 9] Hackmons Cup,f|[Gen 9] Doubles Hackmons Cup,d|[Gen 9] Broken Cup,d|[Gen 9] Challenge Cup 1v1,f|[Gen 9] Challenge Cup 2v2,f|[Gen 9] Challenge Cup 6v6,d|[Gen 9] Metronome Battle,e|[Gen 8] Random Battle,f|[Gen 8] Random Doubles Battle,f|[Gen 8] Free-For-All Random Battle,7|[Gen 8] Multi Random Battle,5|[Gen 8] Battle Factory,f|[Gen 8] BSS Factory,1d|[Gen 8] Hackmons Cup,f|[Gen 8] Metronome Battle,c|[Gen 8] CAP 1v1,d|[Gen 8 BDSP] Random Battle,d|[Gen 7] Random Battle,f|[Gen 7] Battle Factory,f|[Gen 7] BSS Factory,1d|[Gen 7] Hackmons Cup,d|[Gen 7 Let's Go] Random Battle,d|[Gen 6] Random Battle,f|[Gen 6] Battle Factory,9|[Gen 5] Random Battle,f|[Gen 4] Random Battle,f|[Gen 3] Random Battle,f|[Gen 2] Random Battle,f|[Gen 1] Random Battle,f|[Gen 1] Challenge Cup,9|[Gen 1] Hackmons Cup,9|,4|RoA Spotlight|[Gen 3] Ubers,e|[Gen 5] PU,e|[Gen 4] ZU,e|,4|Past Gens OU|[Gen 8] OU,e|[Gen 7] OU,e|[Gen 6] OU,e|[Gen 5] OU,e|[Gen 4] OU,e|[Gen 3] OU,e|[Gen 2] OU,e|[Gen 1] OU,e|,4|Past Gens Doubles OU|[Gen 8] Doubles OU,e|[Gen 7] Doubles OU,e|[Gen 6] Doubles OU,e|[Gen 5] Doubles OU,c|[Gen 4] Doubles OU,c|[Gen 3] Doubles OU,c|,4|Sw/Sh Singles|[Gen 8] Ubers,c|[Gen 8] UU,c|[Gen 8] RU,c|[Gen 8] NU,c|[Gen 8] PU,c|[Gen 8] LC,c|[Gen 8] Monotype,c|[Gen 8] 1v1,c|[Gen 8] Anything Goes,c|[Gen 8] ZU,c|[Gen 8] CAP,c|[Gen 8] Battle Stadium Singles,5c|[Gen 8 BDSP] OU,c|[Gen 8 BDSP] Ubers,c|[Gen 8] Custom Game,c|,4|Sw/Sh Doubles|[Gen 8] Doubles Ubers,c|[Gen 8] Doubles UU,c|[Gen 8] VGC 2022,5c|[Gen 8] VGC 2021,5c|[Gen 8] VGC 2020,5c|[Gen 8 BDSP] Doubles OU,c|[Gen 8 BDSP] Battle Festival Doubles,1c|[Gen 8] Doubles Custom Game,c|,4|US/UM Singles|[Gen 7] Ubers,c|[Gen 7] UU,c|[Gen 7] RU,c|[Gen 7] NU,c|[Gen 7] PU,c|[Gen 7] LC,c|[Gen 7] Monotype,c|[Gen 7] 1v1,c|[Gen 7] Anything Goes,c|[Gen 7] ZU,c|[Gen 7] CAP,c|[Gen 7] Battle Spot Singles,5c|[Gen 7 Let's Go] OU,1c|[Gen 7] Custom Game,c|,4|US/UM Doubles|[Gen 7] Doubles UU,c|[Gen 7] VGC 2019,5c|[Gen 7] VGC 2018,5c|[Gen 7] VGC 2017,5c|[Gen 7] Battle Spot Doubles,5c|[Gen 7 Let's Go] Doubles OU,1c|[Gen 7] Doubles Custom Game,c|,4|OR/AS Singles|[Gen 6] Ubers,c|[Gen 6] UU,c|[Gen 6] RU,c|[Gen 6] NU,c|[Gen 6] PU,c|[Gen 6] LC,c|[Gen 6] Monotype,c|[Gen 6] 1v1,c|[Gen 6] Anything Goes,c|[Gen 6] ZU,c|[Gen 6] CAP,c|[Gen 6] Battle Spot Singles,5c|[Gen 6] Custom Game,c|,4|OR/AS Doubles/Triples|[Gen 6] VGC 2016,5c|[Gen 6] VGC 2015,5c|[Gen 6] VGC 2014,5c|[Gen 6] Battle Spot Doubles,5c|[Gen 6] Doubles Custom Game,c|[Gen 6] Battle Spot Triples,1c|[Gen 6] Triples Custom Game,c|,4|B2/W2 Singles|[Gen 5] Ubers,c|[Gen 5] UU,c|[Gen 5] RU,c|[Gen 5] NU,c|[Gen 5] LC,c|[Gen 5] Monotype,c|[Gen 5] 1v1,c|[Gen 5] ZU,c|[Gen 5] CAP,c|[Gen 5] BW1 OU,c|[Gen 5] GBU Singles,5c|[Gen 5] Custom Game,c|,4|B2/W2 Doubles|[Gen 5] VGC 2013,5c|[Gen 5] VGC 2012,5c|[Gen 5] VGC 2011,5c|[Gen 5] Doubles Custom Game,c|[Gen 5] Triples Custom Game,c|,4|DPP Singles|[Gen 4] Ubers,c|[Gen 4] UU,c|[Gen 4] NU,c|[Gen 4] PU,c|[Gen 4] LC,c|[Gen 4] Anything Goes,c|[Gen 4] 1v1,c|[Gen 4] CAP,c|[Gen 4] Custom Game,c|,4|DPP Doubles|[Gen 4] VGC 2010,1c|[Gen 4] VGC 2009,1c|[Gen 4] Doubles Custom Game,c|,4|Past Generations|[Gen 3] UU,c|[Gen 3] RU,c|[Gen 3] NU,c|[Gen 3] PU,c|[Gen 3] LC,c|[Gen 3] 1v1,c|[Gen 3] ZU,c|[Gen 3] Custom Game,c|[Gen 3] Doubles Custom Game,c|[Gen 2] Ubers,c|[Gen 2] UU,c|[Gen 2] NU,c|[Gen 2] PU,c|[Gen 2] 1v1,c|[Gen 2] ZU,c|[Gen 2] NC 2000,c|[Gen 2] Stadium OU,c|[Gen 2] Custom Game,c|[Gen 1] Ubers,c|[Gen 1] UU,c|[Gen 1] NU,c|[Gen 1] PU,c|[Gen 1] 1v1,c|[Gen 1] ZU,c|[Gen 1] Japanese OU,c|[Gen 1] Stadium OU,c|[Gen 1] Tradebacks OU,c|[Gen 1] NC 1997,c|[Gen 1] Custom Game,c
Logged in as asyncruby
|updatesearch|{"searching":[],"games":null}
|updateuser| async-ruby|1|101|{"blockChallenges":false,"blockPMs":false,"ignoreTickets":false,"hideBattlesFromTrainerCard":false,"blockInvites":false,"doNotDisturb":false,"blockFriendRequests":false,"allowFriendNotifications":false,"displayBattlesToFriends":false,"hideLogins":false,"hiddenNextBattle":false,"inviteOnlyNextBattle":false,"language":null}
|updatesearch|{"searching":[],"games":null}
|updatesearch|{"searching":["gen9randombattle"],"games":null}
|updatesearch|{"searching":[],"games":null}
|updatesearch|{"searching":[],"games":{"battle-gen9randombattle-2234455557":"[Gen 9] Random Battle*"}}
|updatesearch|{"searching":[],"games":{"battle-gen9randombattle-2234455557":"[Gen 9] Random Battle*"}}
>battle-gen9randombattle-2234455557
|init|battle
|title|jubuujo vs. async-ruby
|j|☆jubuujo
|j|☆async-ruby
>battle-gen9randombattle-2234455557
|t:|1730340680
|gametype|singles
>battle-gen9randombattle-2234455557
|player|p1|jubuujo|265|1028
>battle-gen9randombattle-2234455557
|player|p2|async-ruby|101|1000
|teamsize|p1|6
|teamsize|p2|6
|gen|9
|tier|[Gen 9] Random Battle
|rated|
|rule|Species Clause: Limit one of each Pokémon
|rule|HP Percentage Mod: HP is shown in percentages
|rule|Sleep Clause Mod: Limit one foe put to sleep
|rule|Illusion Level Mod: Illusion disguises the Pokémon's true level
|
|t:|1730340680
|start
|switch|p1a: Torkoal|Torkoal, L88, M|100/100
|switch|p2a: Tornadus|Tornadus-Therian, L79, M|254/254
|-weather|SunnyDay|[from] ability: Drought|[of] p1a: Torkoal
|turn|1
~~~COMMAND_TO_SEND~~~: battle-gen9randombattle-2234455557|/choose default
|pm|!async-ruby|~|/error /choose - must be used in a chat room, not a console

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.

ioquatix commented 15 hours ago

Okay, I'll take a look.

ioquatix commented 14 hours ago
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.