File tree Expand file tree Collapse file tree 4 files changed +7
-5
lines changed
Expand file tree Collapse file tree 4 files changed +7
-5
lines changed Original file line number Diff line number Diff line change 1- import { createApp , createRouter } from "h3" ;
1+ import { createApp } from "h3" ;
22import { defineWebSocketHooks } from "crossws" ;
33
44export const app = createApp ( ) ;
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ <h3>WebSocket Test Page</h3>
3939 < br />
4040 </ div >
4141
42- < div id ="logs "> </ div >
42+ < pre id ="logs "> </ pre >
4343
4444 < script type ="module ">
4545 const url = "ws://" + location . host + "/_ws" ;
Original file line number Diff line number Diff line change @@ -4,8 +4,10 @@ import {
44 defineWebSocketHooks ,
55} from "../src/index.ts" ;
66
7- export const getIndexHTML = ( params ) =>
8- import ( "../examples/h3/index.html.ts" ) . then ( ( r ) => r . html ( params ) ) ;
7+ export const getIndexHTML = ( ) =>
8+ fetch (
9+ "https://raw.githubusercontent.com/unjs/crossws/main/examples/h3/public/index.html" ,
10+ ) . then ( ( res ) => res . text ( ) ) ;
911
1012export function createDemo < T extends WebSocketAdapter > (
1113 adapter : T ,
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ const adapter = createDemo(nodeAdapter);
88
99const server = createServer ( async ( req , res ) => {
1010 res . writeHead ( 200 , { "Content-Type" : "text/html" } ) ;
11- res . end ( await getIndexHTML ( { name : "node-ws" } ) ) ;
11+ res . end ( await getIndexHTML ( ) ) ;
1212} ) ;
1313
1414server . on ( "upgrade" , adapter . handleUpgrade ) ;
You can’t perform that action at this time.
0 commit comments