You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// apps/backend/lambda/index.tsimport{serve}from"@hono/node-server";serve({fetch: app.fetch,port: 3000,},(info)=>{console.log(`Server is running on http://localhost:${info.port}`);});
I am struggling here as createNodeWebSocket comes from @hono/node-ws but app.ts needs to be runtime agnostic so it can be used in node for local dev on in AWS Lambda for production. I am also not sure how, where or when to call injectWebSocket.
If I am thinking about this completely incorrectly, please let me know.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am working on an API where I need to have a websocket route. Since I need to deploy on AWS Lambda, I am looking to find the right way to set it up.
To run things locally for development, I use the node runtime. I have three main files:
As you can see,
app.tsholds the server logic,index.tsallows me to run the server locally and I usehandler.tsfor deployment on lambda via cdk.Here is where I am struggling:
I am struggling here as
createNodeWebSocketcomes from@hono/node-wsbutapp.tsneeds to be runtime agnostic so it can be used in node for local dev on in AWS Lambda for production. I am also not sure how, where or when to callinjectWebSocket.If I am thinking about this completely incorrectly, please let me know.
Beta Was this translation helpful? Give feedback.
All reactions