Narrows a Durable Object stub's response to one carrying a socket.
A stub answering an ordinary Response — a 404 from a DO class with no
upgrade path, a 500 from one that threw, a 101 from a runtime that does not
populate webSocket — fails here, naming the binding, rather than surfacing
later as a TypeError on undefined.accept() with nothing to point at.
Parameters
response: unknown
The stub's response
binding: string
The Durable Object binding name, for the error message
Narrows a Durable Object stub's response to one carrying a socket.
A stub answering an ordinary
Response— a 404 from a DO class with no upgrade path, a 500 from one that threw, a 101 from a runtime that does not populatewebSocket— fails here, naming the binding, rather than surfacing later as aTypeErroronundefined.accept()with nothing to point at.