Skip to content

Commit

Permalink
ensure WebSocket's are always closed with an explicit code (#4157)
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-smart authored Dec 18, 2024
1 parent 9b8e49c commit e66b920
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/small-pets-sin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@effect/platform": patch
---

ensure WebSocket's are always closed with an explicit code
2 changes: 1 addition & 1 deletion packages/platform/src/Socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ export const makeWebSocket = (url: string | Effect.Effect<string>, options?: {
(typeof url === "string" ? Effect.succeed(url) : url).pipe(
Effect.flatMap((url) => Effect.map(WebSocketConstructor, (f) => f(url, options?.protocols)))
),
(ws) => Effect.sync(() => ws.close())
(ws) => Effect.sync(() => ws.close(1000))
),
options
)
Expand Down

0 comments on commit e66b920

Please sign in to comment.