Been paid to code since 1998.
I'm a Principal Software Engineer @G-P, I like free and open-source software and all things AWS Serverless / JavaScript 😊.
Currently I'm working on SAM tooling with sam-expand, and starterstack.
aws lambda websocket server.
Home Page: https://npm.im/aws-lambda-ws-server
License: Apache License 2.0
Been paid to code since 1998.
I'm a Principal Software Engineer @G-P, I like free and open-source software and all things AWS Serverless / JavaScript 😊.
Currently I'm working on SAM tooling with sam-expand, and starterstack.
Hi,
Nice repo. Just what I need. If I want to deploy in AWS without serverless it looks like I specify a function based on the code in your usage example as the backend lambda for all routes: $connect, $disconnect, $default, message (and any other custom routes). Is this correct.
Thanks,
Bob
How would this server work with the WebSockets example shown here: https://github.com/aws-samples/simple-websockets-chat-app ? Not really sure how to run the server with this application locally.
Please upgrade ws
dependency per security vulnerability GHSA-6fc8-4gx4-v693
Basically update aws-lambda-ws-server/packages/aws-lambda-ws-server/package.json
dependency of ws
to >= 7.4.6
.
npm audit fix --force
downgrades aws-lambda-ws-server !
Thanks
Hi,
I'm trying to use your ws server for a project where I have a custom domain name attached to the API Gateway.
In aws-post-to-connection, an aws4 signed URL is created from the domainName in the context. This works fine if my API url is something like xxxxx.execute-api.my-region.amazonaws.com
, but in my case domainName gets set to api.mydomain.com
. This makes the call fail (InvalidTokenException, or similar).
I tried adding URL mappings for my stage, so that api.mydomain.com/prod
maps to the prod stage, but that doesn't seem to help. The only way I can get it to work is to inject the "real" API url as an ENV variable, and change your code that sets the host to
host: process.env.API_URL || domainName
Is there any way to add support for custom domain names? I'm not 100% sure what's needed to make this work, but currently I have to modify the package code to get this to work properly. Any pointers appreciated.
🚨 You need to enable Continuous Integration on Greenkeeper branches of this repository. 🚨
To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.
Since we didn’t receive a CI status on the greenkeeper/initial
branch, it’s possible that you don’t have CI set up yet. We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.
If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/
.
Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please click the 'fix repo' button on account.greenkeeper.io.
Would be great to have a .d.ts file provided :)
Hi, I'm using this lib with yjs and ran into an error when I saw it was trying to parse the binary message to JSON in local.js. It also tries to parse it again in handler.js. Also it tries to stringify any binary messages sent back to the client.
Also should note that the postconnection lib also seems not to support binary messages. Note I haven't tested if this is even possible in the cloud yet and it's unfortunately not documented if it is.
Normally this seems to conform to the Websocket API specification, but I imagine many libraries are used to communicating binary messages over websockets (see https://tools.ietf.org/html/rfc6455 and search 'binary frame'). There is even a CFN option to enable this:
contentHandlingStrategy: 'CONVERT_TO_BINARY', // see http://amzn.to/39DkYP4
My suggestion would be when parsing JSON fails, fall back to simply not parsing it, or at least check if it's a Buffer
which would indicate it's a binary message. Locally on the ws server we also need to specify connection.binaryType = 'arraybuffer'
, so maybe this is better as a configuration variable.
Edit: feel free to close, I found out AWS doesn't support returning binary messages anyway. i'm going to work with base64 encoded text instead, which is still incompatible with JSON.stringify so something to consider perhaps for the next version (removing json stringify and parse)
Hi, Thanks for making these tools.
I have some question, how we can passing params & use an event in our function?
Usually, we use this format for our lambda
exports.handler = async (event, context, callback) => {})
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.