mirror of
https://github.com/socketio/socket.io.git
synced 2026-01-10 07:28:06 -05:00
fix(types): make io#httpServer public (#5035)
Related: https://github.com/socketio/socket.io/issues/5034
This commit is contained in:
@@ -169,6 +169,12 @@ export class Server<
|
||||
*
|
||||
*/
|
||||
public engine: BaseServer;
|
||||
/**
|
||||
* The underlying Node.js HTTP server.
|
||||
*
|
||||
* @see https://nodejs.org/api/http.html
|
||||
*/
|
||||
public httpServer: TServerInstance;
|
||||
|
||||
/** @private */
|
||||
readonly _parser: typeof parser;
|
||||
@@ -209,7 +215,6 @@ export class Server<
|
||||
* @private
|
||||
*/
|
||||
_connectTimeout: number;
|
||||
private httpServer: TServerInstance;
|
||||
private _corsMiddleware: (
|
||||
req: http.IncomingMessage,
|
||||
res: http.ServerResponse,
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
SocketOptions,
|
||||
} from "socket.io-client";
|
||||
import request from "supertest";
|
||||
import type { AddressInfo } from "node:net";
|
||||
import type { DefaultEventsMap, EventsMap } from "../../lib/typed-events";
|
||||
|
||||
const expect = require("expect.js");
|
||||
@@ -40,8 +41,7 @@ export function createClient<
|
||||
nsp: string = "/",
|
||||
opts?: Partial<ManagerOptions & SocketOptions>
|
||||
): ClientSocket<STC, CTS> {
|
||||
// @ts-ignore
|
||||
const port = io.httpServer.address().port;
|
||||
const port = (io.httpServer.address() as AddressInfo).port;
|
||||
return ioc(`http://localhost:${port}${nsp}`, opts);
|
||||
}
|
||||
|
||||
@@ -74,8 +74,7 @@ export function assert(condition: any): asserts condition {
|
||||
}
|
||||
|
||||
export function getPort(io: Server): number {
|
||||
// @ts-ignore
|
||||
return io.httpServer.address().port;
|
||||
return (io.httpServer.address() as AddressInfo).port;
|
||||
}
|
||||
|
||||
export function createPartialDone(count: number, done: (err?: Error) => void) {
|
||||
|
||||
Reference in New Issue
Block a user