98thpixel
CDCloudflare Developers
•Created by 98thpixel on 3/17/2024 in #workers-help
Uncaught (in response) Error: The script will never generate a response
Hi all,
I get the below error when a WebSocket client gets disconnected:
✘ [ERROR] Uncaught (in response) Error: The script will never generate a response.
My Workers code is super minimal (a sample code I found online):
export default {
fetch(request) {
const [client, server] = Object.values(new WebSocketPair());
server.accept();
server.addEventListener("message", (event) => {
server.send(event.data);
});
return new Response(null, {
status: 101,
webSocket: client,
});
},
};
Any advise would be really appreciated!1 replies
CDCloudflare Developers
•Created by 98thpixel on 1/11/2024 in #workers-help
Can we lookup instances of DOs from one DO's WebSocket message handler?
I’ve been trying to using DOs for websocket handling, I’ve seen that the message handling function is getting called when I send a message from the front end. However, I also saw that there is no context object being passed to that function. How can I lookup other DO instances in the function that handles incoming websocket messages?
Thanks in advance
4 replies