File tree Expand file tree Collapse file tree 4 files changed +11
-198
lines changed
Expand file tree Collapse file tree 4 files changed +11
-198
lines changed Original file line number Diff line number Diff line change @@ -9,9 +9,9 @@ const app = new Elysia({
99} )
1010 . use ( cors ( ) )
1111 . use ( swagger ( ) )
12- . ws ( '/ws' , {
13- open ( ) {
14- console . log ( 'OPENED' )
12+ . ws ( '/ws/:id ' , {
13+ open ( { data } ) {
14+ console . log ( data . params )
1515 } ,
1616 message ( ws , message ) {
1717 ws . send ( message )
Original file line number Diff line number Diff line change @@ -38,8 +38,10 @@ import { ServerWebSocket } from 'elysia/ws/bun'
3838import { parseSetCookies } from 'elysia/adapter/utils'
3939
4040const toServerWebSocket = ( ws : ServerWebSocket ) => {
41- // @ts -ignore
42- ws . data = ws . context
41+ // @ts -ignore, context.context is intentional
42+ // first context is srvx.context (alias of bun.ws.data)
43+ // second context is Elysia context
44+ ws . data = ws . context . context
4345 ws . sendText = ws . send
4446 ws . sendBinary = ws . send
4547 ws . publishText = ws . publish
Original file line number Diff line number Diff line change 1- import type { Context } from 'elysia/context'
2- import { isNotEmpty } from 'elysia/utils'
1+ import { FastResponse as Response } from 'srvx'
32import type { ReadStream } from 'fs'
43
4+ import { isNotEmpty } from 'elysia/utils'
5+ import type { Context } from 'elysia/context'
6+
57export const handleFile = (
68 response : ReadStream | File | Blob ,
79 set ?: Context [ 'set' ]
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments