@midwayjs/ws 3.20.3 → 3.20.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/framework.js CHANGED
@@ -102,6 +102,7 @@ let MidwayWSFramework = class MidwayWSFramework extends core_1.BaseFramework {
102
102
  // create request context
103
103
  this.app.createAnonymousContext(socket);
104
104
  socket.requestContext.registerObject('socket', socket);
105
+ socket.request = request;
105
106
  socket.app = this.app;
106
107
  // run connection middleware
107
108
  const connectFn = await this.middlewareService.compose([
@@ -1,5 +1,7 @@
1
+ /// <reference types="node" />
1
2
  import * as WebSocket from 'ws';
2
3
  import { CommonMiddlewareUnion, ContextMiddlewareManager, IConfigurationOptions, IMidwayApplication, IMidwayContext, NextFunction as BaseNextFunction } from '@midwayjs/core';
4
+ import type { IncomingMessage } from 'http';
3
5
  export type IMidwayWSApplication = IMidwayApplication<IMidwayWSContext, {
4
6
  useConnectionMiddleware: (middleware: CommonMiddlewareUnion<Context, NextFunction, undefined>) => void;
5
7
  getConnectionMiddleware: ContextMiddlewareManager<Context, NextFunction, undefined>;
@@ -19,6 +21,7 @@ export type IMidwayWSConfigurationOptions = {
19
21
  export type IMidwayWSContext = IMidwayContext<WebSocket & {
20
22
  app: IMidwayWSApplication;
21
23
  isAlive: boolean;
24
+ request: IncomingMessage;
22
25
  }>;
23
26
  export type Application = IMidwayWSApplication;
24
27
  export type NextFunction = BaseNextFunction;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midwayjs/ws",
3
- "version": "3.20.3",
3
+ "version": "3.20.8",
4
4
  "description": "Midway Web Framework for ws",
5
5
  "main": "dist/index.js",
6
6
  "typings": "index.d.ts",
@@ -23,8 +23,8 @@
23
23
  ],
24
24
  "license": "MIT",
25
25
  "devDependencies": {
26
- "@midwayjs/core": "^3.20.3",
27
- "@midwayjs/mock": "^3.20.3",
26
+ "@midwayjs/core": "^3.20.4",
27
+ "@midwayjs/mock": "^3.20.4",
28
28
  "fs-extra": "11.3.0"
29
29
  },
30
30
  "dependencies": {
@@ -39,5 +39,5 @@
39
39
  "engines": {
40
40
  "node": ">=12"
41
41
  },
42
- "gitHead": "a0918e46838e220fd000997796dbc8d669d28746"
42
+ "gitHead": "561d0e178875f28fcb98efaf6570e981b17b3870"
43
43
  }