feat: 同步 socket.io 上游代码

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
2023-02-09 13:49:48 +08:00
parent 359aeb9d63
commit 7b85ff5b7c
35 changed files with 7612 additions and 6519 deletions

View File

@@ -1,26 +1,26 @@
// import { createServer } from "http"
import { Server, AttachOptions, ServerOptions } from "./server"
import transports from "./transports/index"
import * as parser from "../engine.io-parser"
import { Server, AttachOptions, ServerOptions } from "./server";
import transports from "./transports/index";
import * as parser from "../engine.io-parser";
// export { Server, transports, listen, attach, parser }
export { Server, transports, attach, parser }
export { AttachOptions, ServerOptions } from "./server"
export { Server, transports, attach, parser };
export { AttachOptions, ServerOptions } from "./server";
// export { uServer } from "./userver";
export { Socket } from "./socket"
export { Transport } from "./transport"
export const protocol = parser.protocol
/**
* Creates an http.Server exclusively used for WS upgrades.
*
* @param {Number} port
* @param {Function} callback
* @param {Object} options
* @return {Server} websocket.io server
* @api public
*/
export { Socket } from "./socket";
export { Transport } from "./transport";
export const protocol = parser.protocol;
// /**
// * Creates an http.Server exclusively used for WS upgrades.
// *
// * @param {Number} port
// * @param {Function} callback
// * @param {Object} options
// * @return {Server} websocket.io server
// * @api public
// */
//
// function listen(port, options: AttachOptions & ServerOptions, fn) {
// if ("function" === typeof options) {
// fn = options;
@@ -51,7 +51,7 @@ export const protocol = parser.protocol
*/
function attach(server, options: AttachOptions & ServerOptions) {
const engine = new Server(options)
engine.attach(server, options)
return engine
const engine = new Server(options);
engine.attach(server, options);
return engine;
}