@middy/ws-response 4.0.0 → 4.0.2
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/README.md +0 -69
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -36,75 +36,6 @@
|
|
|
36
36
|
<p>You can read the documentation at: <a href="https://middy.js.org/docs/middlewares/ws-responder">https://middy.js.org/docs/middlewares/ws-responder</a></p>
|
|
37
37
|
</div>
|
|
38
38
|
|
|
39
|
-
Post message to WebSocket connection.
|
|
40
|
-
|
|
41
|
-
## Install
|
|
42
|
-
|
|
43
|
-
To install this middleware you can use NPM:
|
|
44
|
-
|
|
45
|
-
```bash
|
|
46
|
-
npm install --save @middy/ws-response
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
## Options
|
|
50
|
-
|
|
51
|
-
- `AwsClient` (object) (default `ApiGatewayManagementApiClient`): ApiGatewayManagementApiClient class constructor (i.e. that has been instrumented with AWS XRay). Must be from `@aws-sdk/client-apigatewaymanagementapi`.
|
|
52
|
-
- `awsClientOptions` (object) (default `undefined`): Options to pass to ApiGatewayManagementApiClient class constructor.
|
|
53
|
-
- `awsClientAssumeRole` (string) (default `undefined`): Internal key where secrets are stored. See [@middy/sts](/packages/sts/README.md) on to set this.
|
|
54
|
-
- `awsClientCapture` (function) (default `undefined`): Enable XRay by passing `captureAWSClient` from `aws-xray-sdk` in.
|
|
55
|
-
- `disablePrefetch` (boolean) (default `false`): On cold start requests will trigger early if they can. Setting `awsClientAssumeRole` disables prefetch.
|
|
56
|
-
|
|
57
|
-
NOTES:
|
|
58
|
-
|
|
59
|
-
- Lambda is required to have IAM permission for `execute-api:ManageConnections`
|
|
60
|
-
- If `awsClientOptions.endpoint` is not set it will be set using `event.requestContext.{domainName,stage}`
|
|
61
|
-
- If response does not contain `ConnectId`, it will be set from `event.requestContext.connectionId`
|
|
62
|
-
|
|
63
|
-
## Sample usage
|
|
64
|
-
|
|
65
|
-
### API Gateway
|
|
66
|
-
|
|
67
|
-
```javascript
|
|
68
|
-
import middy from '@middy/core'
|
|
69
|
-
import wsResponse from '@middy/ws-response'
|
|
70
|
-
|
|
71
|
-
export const handler = middy((event, context) => {
|
|
72
|
-
return 'message'
|
|
73
|
-
})
|
|
74
|
-
|
|
75
|
-
handler.use(wsResponse())
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
### General
|
|
79
|
-
|
|
80
|
-
```javascript
|
|
81
|
-
import middy from '@middy/core'
|
|
82
|
-
import wsResponse from '@middy/ws-response'
|
|
83
|
-
|
|
84
|
-
export const handler = middy((event, context) => {
|
|
85
|
-
return {
|
|
86
|
-
ConnectionId: '...',
|
|
87
|
-
Data: 'message'
|
|
88
|
-
}
|
|
89
|
-
})
|
|
90
|
-
|
|
91
|
-
handler.use(
|
|
92
|
-
wsResponse({
|
|
93
|
-
awsClientOptions: {
|
|
94
|
-
endpoint: '...'
|
|
95
|
-
}
|
|
96
|
-
})
|
|
97
|
-
)
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
## Middy documentation and examples
|
|
101
|
-
|
|
102
|
-
For more documentation and examples, refers to the main [Middy monorepo on GitHub](https://github.com/middyjs/middy) or [Middy official website](https://middy.js.org).
|
|
103
|
-
|
|
104
|
-
## Contributing
|
|
105
|
-
|
|
106
|
-
Everyone is very welcome to contribute to this repository. Feel free to [raise issues](https://github.com/middyjs/middy/issues) or to [submit Pull Requests](https://github.com/middyjs/middy/pulls).
|
|
107
|
-
|
|
108
39
|
## License
|
|
109
40
|
|
|
110
41
|
Licensed under [MIT License](LICENSE). Copyright (c) 2017-2022 [Luciano Mammino](https://github.com/lmammino), [will Farrell](https://github.com/willfarrell), and the [Middy team](https://github.com/middyjs/middy/graphs/contributors).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@middy/ws-response",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"description": "WebSocket response handling middleware for the middy framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -61,13 +61,13 @@
|
|
|
61
61
|
},
|
|
62
62
|
"homepage": "https://middy.js.org",
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@middy/util": "4.0.
|
|
64
|
+
"@middy/util": "4.0.2"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@aws-sdk/client-apigatewaymanagementapi": "^3.186.0",
|
|
68
|
-
"@middy/core": "4.0.
|
|
68
|
+
"@middy/core": "4.0.2",
|
|
69
69
|
"@types/aws-lambda": "^8.10.97",
|
|
70
70
|
"aws-xray-sdk": "^3.3.3"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "c77c9413ecb80999a71b67ff97edac1fed2ca754"
|
|
73
73
|
}
|