-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers
Description
I think it would be nice, if this adapter would support websockets that can be handled from within a sveltekit app.
Maybe with the new filestructure, we can use routes/ws/+websocket.js files.
I guess we would need to create a vite plugin, to support websockets in dev mode.
How a +websocket.js file could look like:
// routes/example/+websocket.js
export function OPEN({ ws }: { ws: WebSocket }) {
}
export function MESSAGE({ ws, message, isBinary }: { ws: WebSocket; message: ArrayBuffer; isBinary: boolean }) {
}
export function CLOSE({ ws, code, message }: { ws: WebSocket; code: number; message: ArrayBuffer }) {
}OR a default export of the WebSocketBehavior type
// routes/example/+websocket.js
/** @type import('uWebSocket').WebSocketBehavior */
export default {
open(ws) {},
message(ws, message, isBinary) {},
close(ws, code, message) {},
};But it would be good to have the app available in these functions as well, to publish a message. Or maybe just a publish function that is passed as parameter to these functions.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers