fix(miniflare): support WebSocket proxying over dev registry#10273
fix(miniflare): support WebSocket proxying over dev registry#10273edmundhung merged 1 commit intomainfrom
Conversation
🦋 Changeset detectedLatest commit: 9b0d4ec The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
create-cloudflare
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-editor-shared
wrangler
commit: |
413edbd to
8897ef2
Compare
8897ef2 to
9b0d4ec
Compare
| const statusLine = `HTTP/1.1 ${upRes.statusCode ?? 101} ${upRes.statusMessage ?? "Switching Protocols"}\r\n`; | ||
| let headersString = ""; | ||
| for (let i = 0; i < upRes.rawHeaders.length; i += 2) { | ||
| headersString += `${upRes.rawHeaders[i]}: ${upRes.rawHeaders[i + 1]}\r\n`; |
There was a problem hiding this comment.
OOC is the \r\n rather than just \n to ensure it is valid on Windows?
There was a problem hiding this comment.
It's just because the HTTP/1.1 Spec requires these lines to be terminated with CLRF (\r\n): https://datatracker.ietf.org/doc/html/rfc7230#section-3
| wsResponse.webSocket.accept(); | ||
|
|
||
| // Test bidirectional communication | ||
| wsResponse.webSocket.send("ping"); |
There was a problem hiding this comment.
Is there a chance that this ping will cause a response before you have setup the listener?
There was a problem hiding this comment.
Good call. I will move this after the messagePromise in a follow up PR.
Fixes n/a.