What is the problem this feature would solve?
Streamline including socket protocols in the client, and parsing socket protocols in http APIs.
What is the feature you are proposing to solve the problem?
Some minimal socket protocol utils.
export const SocketProtocolsKey = "Sec-WebSocket-Protocol" as const
const SocketProtocols = S.String.pipe(
S.decodeTo(S.Array(S.Trim), {
decode: SchemaGetter.split({ separator: "," }),
encode: SchemaGetter.transform((arr) => arr.join(",")),
}),
)
Ideally there'd also be a requirement that we could optionally provide to any SocketConstructor.
mySocketClient.pipe(
Layer.provide(Socket.layerWebSocketConstructorGlobal.pipe(Layer.provide(SocketProtocols.layer(["a", "b", "c"]))))
)
And a piece of http middleware for parsing the protocols from an HttpServerRequest.
const handler = Effect.gen(function*() {
const protocols = yield* SocketProtocols
})
What alternatives have you considered?
No response
What is the problem this feature would solve?
Streamline including socket protocols in the client, and parsing socket protocols in http APIs.
What is the feature you are proposing to solve the problem?
Some minimal socket protocol utils.
Ideally there'd also be a requirement that we could optionally provide to any
SocketConstructor.And a piece of http middleware for parsing the protocols from an
HttpServerRequest.What alternatives have you considered?
No response