Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/engine.io/lib/transport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function noop() {}
type ReadyState = "open" | "closing" | "closed";

export type EngineRequest = IncomingMessage & {
_query: Record<string, string>;
_query?: Record<string, string>;
res?: ServerResponse;
cleanup?: Function;
websocket?: WebSocket & {
Expand Down Expand Up @@ -89,9 +89,9 @@ export abstract class Transport extends EventEmitter {
*
* @param {EngineRequest} req
*/
constructor(req: { _query: Record<string, string> }) {
constructor(req: { _query?: Record<string, string> }) {
super();
this.protocol = req._query.EIO === "4" ? 4 : 3; // 3rd revision by default
this.protocol = req._query?.EIO === "4" ? 4 : 3; // 3rd revision by default
this.parser = this.protocol === 4 ? parser_v4 : parser_v3;
this.supportsBinary = !(req._query && req._query.b64);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/engine.io/lib/transports/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default {
* Polling polymorphic constructor.
*/
function polling(req: EngineRequest) {
if ("string" === typeof req._query.j) {
if ("string" === typeof req._query?.j) {
return new JSONP(req);
} else {
return new XHR(req);
Expand Down