Bug Description
As discussed in #163, when sending WebSocket messages in dev mode, the server receives the literal string "[object Blob]" instead of the actual message content.
Steps to Reproduce
// Client code
const socket = new WebSocket('ws://localhost:4321/api/ws');
socket.onopen = () => {
socket.send("foo");
};
// Server receives: "[object Blob]"
// Expected: "foo"
Environment
- Using
bunx to run dev server
- astro-bun-websocket with gratelets/bun-websocket package
Root Cause
The issue appears to be related to how the dev middleware handles message conversion when the underlying ws package receives data. The data is incorrectly converted to string, resulting in the default JavaScript object toString representation.
Bug Description
As discussed in #163, when sending WebSocket messages in dev mode, the server receives the literal string
"[object Blob]"instead of the actual message content.Steps to Reproduce
Environment
bunxto run dev serverRoot Cause
The issue appears to be related to how the dev middleware handles message conversion when the underlying
wspackage receives data. The data is incorrectly converted to string, resulting in the default JavaScript object toString representation.