We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ws.ping()
1.0.14+d8be3e51b
Darwin 23.1.0 arm64 arm
I'm attempting to migrate an app that uses express-ws but it seems like the WebSocket implementation is not compatible.
It seems like this should have been closed by #3257 but ping didn't make it on to BunWebSocketMocked.
ping
BunWebSocketMocked
// index.ts import express from 'express'; import expressWs from 'express-ws'; const { app } = expressWs(express()); app.ws('/', (ws) => { console.log('ws connected'); const interval = setInterval(() => { console.log('sending ping'); ws.ping(); }, 5000); ws.on('close', () => { console.log('ws closed'); clearInterval(interval); }); }); app.listen(3000);
Once the server has started, use a WebSocket client to connect.
websocat ws://localhost:3000
ws connected sending ping closing ws
ws connected sending ping 5 | 6 | app.ws('/', (ws) => { 7 | console.log('ws connected'); 8 | const interval = setInterval(() => { 9 | console.log('sending ping'); 10 | ws.ping(); ^ TypeError: ws.ping is not a function. (In 'ws.ping()', 'ws.ping' is undefined) at /Users/tobiasbutler/Documents/code/express-ws-example/index.ts:10:4
I can see ping is implemented on BunWebSocketMocked.#ws but it is not exposed directly on BunWebSocketMocked
BunWebSocketMocked.#ws
The text was updated successfully, but these errors were encountered:
@Electroid based on your work on #3257, is this a bug or expected behavior?
Sorry, something went wrong.
running into this trying to use WebSocketServer from "ws" too
Seems like both WebSocket.ping and WebSocket.terminate aren't implemented/exposed in BunWebSocketMocked
This prevents eg. webpack-dev-server from working
Fixed by #9461
No branches or pull requests
What version of Bun is running?
1.0.14+d8be3e51b
What platform is your computer?
Darwin 23.1.0 arm64 arm
What steps can reproduce the bug?
I'm attempting to migrate an app that uses express-ws but it seems like the WebSocket implementation is not compatible.
It seems like this should have been closed by #3257 but
ping
didn't make it on toBunWebSocketMocked
.Once the server has started, use a WebSocket client to connect.
What is the expected behavior?
What do you see instead?
Additional information
I can see
ping
is implemented onBunWebSocketMocked.#ws
but it is not exposed directly onBunWebSocketMocked
The text was updated successfully, but these errors were encountered: