-
Notifications
You must be signed in to change notification settings - Fork 89
Conversation
@benycodes Should |
No. |
@benycodes Thanks for doing this, in response to @vicary and @RamIdeas, the Response object should also be able to return a webSocket. For example, if you have a connection from your worker to a durable object through WebSockets (or another WebSocket server), the fetch request to upgrade that connection to WebSockets will return the So yes, we should have |
@ItsWendell thanks for the clarification. Yes, it makes sense to include |
Co-authored-by: Alaa Zorkane <Alaazorkane@gmail.com>
declare class WebSocketPair extends Array { | ||
0: WebSocket; | ||
1: WebSocket; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I see that there's been back and forth on this, but this actually isn't correct. Extending an Array means that this could be possible, which it isn't:
let [client, server] = new WebSocketPair;
The correct solution is to do the equivalent of what worktop does, which is this:
declare class WebSocketPair extends Array { | |
0: WebSocket; | |
1: WebSocket; | |
} | |
declare const WebSocketPair: { | |
new(): { | |
0: WebSocket; | |
1: WebSocket; | |
}; | |
}; |
Here's a Playground to see the differences.
I see this hasn't been touched for some time. Would that be okay if I take over this PR or create a new one? |
No reason for another PR here, thank you though. There's some other work being done wrt types right now, hence the temporary pause. |
Auto-Generated Types Types are now automatically generated with releases by parsing the runtime's source code, and merging in overrides/docs defined in this repository (for generics, overloads, comments, etc). webworker no longer needs to (and shouldn't) be included in tsconfig lib. The final merged AST that's used to render the TypeScript types, workers.json, is also included in the repository. This could be used to generate bindings for other languages that compile to WebAssembly. Rust output is coming soon. Closes: #55, #75, #76, #81, #84, #96, #97, #100, #101, #102, #105, #106, #107, #108
#112 has now been merged, which includes the new |
Added the following:
Closes:
#84