unjs / crossws

🔌 Cross-platform WebSocket Servers for Node.js, Deno, Bun and Cloudflare Workers.
https://crossws.unjs.io
Other
395 stars 17 forks source link

peer.close() does not pass code and reason to hooks #82

Open WerdoxDev opened 2 months ago

WerdoxDev commented 2 months ago

Environment

Bun 1.1.29 Crossws 0.3.1

Reproduction

  1. Create a bun crossws instance
  2. Define a close hook
  3. Run peer.close(4001, "some reason");

Describe the bug

using peer.close(4001, "some-reason") does not pass the code and reason to the close hook.

It seems that an empty {} object is being passed to it. https://github.com/unjs/crossws/blob/05ded7bd961d26d310786f529c0deb8cf9dcf02c/src/adapters/bun.ts#L62

Additional context

No response

Logs

No response