@fangxq/request
Advanced tools
Comparing version 0.0.32 to 0.0.33
@@ -1,1 +0,1 @@ | ||
export async function listen(host: string, port: number, handler: (src:string,req: any) => Promise<any>): Promise<import('https').Server> | ||
export async function listen(host: string, port: number, handler: (src: string, req: any) => Promise<any>, wsHandler?: WebSocket): Promise<import('https').Server> |
@@ -18,3 +18,3 @@ const fs = require('fs') | ||
module.exports.listen = async function (host, port, handler) { | ||
module.exports.listen = async function (host, port, handler, wshandler) { | ||
const app = express() | ||
@@ -35,2 +35,8 @@ | ||
if (wshandler) { | ||
app.ws('/', function (ws, req) { | ||
wshandler(ws) | ||
}) | ||
} | ||
const server = await new Promise((resolve => { | ||
@@ -37,0 +43,0 @@ const svr = https.createServer({ |
{ | ||
"name": "@fangxq/request", | ||
"version": "0.0.32", | ||
"version": "0.0.33", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "scripts": { |
2821
5
68