#WebSocket close error.

1 messages · Page 1 of 1 (latest)

patent berry
#

Hey guys, I am working on a framework, mostly for my own stuff, and I am seeing an issue where the close event for websockets isn't being triggered, it will trigger if I manually call close against the client, but the server is not triggering close events.

The code in question:
https://github.com/sodacore/core/blob/main/packages/http/src/service/http.ts#L171

I have amended the code locally and added a console.log in there, but no matter what I do, I can't get it to trigger a close event (other than when you call close on the client manually), i.e. if I refresh the page, the connection technically has gone, but the close event is never fired.

I have tested this in a plain app using some sample code and it seems to work, so unsure if I am doing something different here?

Thanks in advance.

You can test it by:

  1. Calling git clone <url> <folder>
  2. Then running bun install; bun script foreach bun install inside of the folder.
  3. Then build it all: bun script foreach bun run build
  4. Then call bun dev
  5. Open http://localhost:3101/testing
lyric nexusBOT
whole token
patent berry
elfin raft
patent berry
#

I changed the code to be simpler

#

That disconnect, only appeared if I triggered ws.close() on the client, refreshing the page, doesn't do anything

#

@fringe garden - I am sorry to direct ping, but according to the list, this seems to be an issue, and no one is ever replying to them, is there something here that I am doing differently? Is there any reason in the Bun library that could cause this kind of issue?

patent berry
#

I am still so confused, I tried copying the code I did in the above demo, and it only works on a blank application with nothing else going on.

I don't really understand how to debug an issue that isn't appearing to be from me...

elfin raft
patent berry
patent berry
#

Something to do with VSCode's port forwarding

#

I don't know if it's due to the way VSCode deals with port forwarding or the way that Bun deals with the proxy in the middle.

patent berry
patent berry
#

I am gonna leave this as a message, please lock it.

But the issue seems to be around port forwarding via VSCode which prevents Bun from triggering a close event, I don't know if it's a Bun or VScode issue, but keeping this information here.