Closed rexwu1104 closed 1 year ago
Does that say: encoding=etf
etf
is probably a typo, you probably meant utf8
no, I use etf.js it is make from discord
it is a encoding for discord, there have "json" and "etf"
what font is that @rexwu1104 ?
it must be this and this is I catched
what font is that @rexwu1104 ?
If you use "json" directly for encoding, you will see these results directly
I use "enoding=json" to try this code, but it still have bug. the discord send me the InvalidSession Event. it mean my packet is wrong, but my packet doesn't have any changes. so, I think it is the bug of WebSocket and the etf.js can't work perfect on bun.
this is the etf.js package url. https://www.npmjs.com/package/etf.js
what font is that @rexwu1104 ?
do you mean this? https://www.erlang.org/doc/apps/erts/erl_ext_dist.html
@rexwu1104 If you have time, are you still seeing this issue on the latest version of Bun? bun upgrade
there is a new error.
it is from erlpack. and here is etf.js error.
This doesn't appear to be a WebSocket
issue.
Code:
const ws = new WebSocket("wss://gateway.discord.gg/?encoding=json&v=10");
ws.addEventListener("message", ({ data }) => console.log(Buffer.from(data).toString()));
Output:
{"t":null,"s":null,"op":10,"d":{"heartbeat_interval":41250,"_trace":["[\"gateway-prd-us-east1-b-pn41\",{\"micros\":0.0}]"]}}
I did try using etf
encoding with the etf.js
package, but received the following error, Incompatible ETF version.
, which does not seem related to Bun.
I use WebSocket to connect this discord gateway, but on onmessage event it doesn't send me anything just a isTrusted property