Repository navigation
ActionCable in Lambda #74
Description
Activity
Not sure yet but I am 90% sure it is possible. There is this discussion here too. #73
This might be helpful to learn more. https://github.com/hopsoft/sr_mini
- Reacted by Sean BjörnssonReacted by Brian LeRoux
- https://twitter.com/brianleroux/status/1086058048659939330 (...)
- https://twitter.com/brianleroux/status/1087770929990492160 (sad)
- https://twitter.com/brianleroux/status/1356387693802868736 (cookie)
- https://twitter.com/brianleroux/status/1405658986200789001 (...)
- https://twitter.com/brianleroux/status/1577979058700578816 (awesome)
Broken out YAML at a glance:
- https://gist.github.com/metaskills/eb173fa3a34b890fd7a9e985fd5f9ecb (full)
- https://gist.github.com/metaskills/88d04470c8caa259bb07427e2477615a (DataTable)
- https://gist.github.com/metaskills/45a5f09bb097fdd7ae7c8c8f5805236a (WS)
- https://gist.github.com/metaskills/a215841725223e2838fdc4c726722774 (Connect)
- https://gist.github.com/metaskills/c461763cad8e055cdde175fea76bbbfd (Default)
- https://gist.github.com/metaskills/6862c2f878800d3e6b32dd72ef4e2717 (Disconnect)
Maybe some ViewComponent learning here too.
Working with WebSocket APIs
- https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api.html
- https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-working-with.websockets.html (CloudFront)
- https://github.com/aws-samples/simple-websockets-chat-app/blob/master/template.yaml (Demo)
Architect JS
- https://github.com/architect/functions/blob/main/src/ws/index.js
- https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api.html
- https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/ApiGatewayManagementApi/Client.html
- https://github.com/architect-examples/arc-example-ws
StimulusReflex & CableReady
Here is also Action Cable protocol description: https://docs.anycable.io/misc/action_cable_protocol
Reacted by Ken CollinsFew current posts on WebSockets & Rails demo apps. Need something simple to play with. Ended up making the lamby-ws project which was a 1/1 implementation from the https://hotwired.dev site on top of a fresh Lamby app.
- https://github.com/customink/lamby-ws 🥇🥇🥇
- https://github.com/marcoroth/boxdrop
- https://github.com/anycable/anycable_rails_demo (🤷🏼 Setup Devcontainer 🌶️ gRPC )
- https://github.com/hopsoft/sr_mini (🥇 Simple 🌶️ Not Rails App)
- https://dev.to/raphox/rails-7-hotwire-turbo-stimulus-modern-web-applications-4o7a
- https://dev.to/lso/the-ultimate-search-for-rails-episode-1-1mi
- https://dev.to/aquadrehz/rails-70-demo-with-hotwire-and-tailwind-4b3d
- https://github.com/silva96/ai_stories (🥇 Simple 🌶️ PostgreSQL)
- https://www.hotrails.dev/turbo-rails
Key:
- 🌶️ Friction.
- 🥇 Love it.
- 🤷🏼 Not sure.
When it is Fun Time
AWS & WebSocket Related Resources
- Building Real-Time Serverless Web Applications with AWS API Gateway WebSocket APIs
- Let's Create A Serverless Notification System With API Gateway
- @aws-sdk/client-apigatewaymanagementapi
AppSync Specific
Side Quests with AppSync & Community Learning
Reacted by Vladimir DementyevDebug event, context for connect, default, disconnect.
Connect
{ "headers": { "Cache-Control": "no-cache", "Cookie": "_session=z5S1u4AQoN2vqGh3%2Bfk%2FpWgcIHCWNgGe1M%2BlspE%2Bq1FUQIwTcqcGc5tFyXr93bDZn6769vf4OqWUq4TXsHe8R4yZXC9zeIzBCOWOaaifW37sRue4JjVUFassXnN5vm%2B%2FWzfhFhIRFyT%2B9T0ePPWqdATgb0ZCHdA257tn25t9BeRrVqMbcSHF%2Fe%2B43tlfDLlPzc5WlZfkFjszX92zHSS5Lq7tC9fn3qDgzeKsoW9V8waP2oxgH6FD8U9jWZqidz2FxU8beB%2BNHhVWzUFGL%2B2o6qvo7MxNc099TWmlVE95mr7Ubu9AevD5mHxyMN42FMIeB2ARd0xBZ%2FD0AHDWHBWj5oMWpuy83UNE66w%3D--hMCIIgPEVKv6Eniv--1qQ1DjeVWmn2%2BxqOpGMksQ%3D%3D", "Host": "3iku9itbbb.execute-api.us-east-1.amazonaws.com", "Origin": "https://lamby-ws.custominktech.com", "Pragma": "no-cache", "Sec-WebSocket-Extensions": "permessage-deflate; client_max_window_bits", "Sec-WebSocket-Key": "mnACBiGQM/8M+Wt3ftwKVQ==", "Sec-WebSocket-Protocol": "actioncable-v1-json, actioncable-unsupported", "Sec-WebSocket-Version": "13", "User-Agent": "Amazon CloudFront", "Via": "1.1 dfbe3a6f5b354f9a5f95a5a6814ce14e.cloudfront.net (CloudFront)", "X-Amz-Cf-Id": "SM51fkUtGtL-3Xd3DxYpc8YxxYV5YtUT3ySVBUdEC_NlWj1diQehPA==", "X-Amzn-Trace-Id": "Root=1-6439884a-78ce49cc6150826e3b1b29ff", "X-Forwarded-For": "98.166.4.233, 130.176.179.72", "X-Forwarded-Host": "lamby-ws.custominktech.com", "X-Forwarded-Port": "443", "X-Forwarded-Proto": "https" }, "multiValueHeaders": { "Cache-Control": [ "no-cache" ], "Cookie": [ "_session=z5S1u4AQoN2vqGh3%2Bfk%2FpWgcIHCWNgGe1M%2BlspE%2Bq1FUQIwTcqcGc5tFyXr93bDZn6769vf4OqWUq4TXsHe8R4yZXC9zeIzBCOWOaaifW37sRue4JjVUFassXnN5vm%2B%2FWzfhFhIRFyT%2B9T0ePPWqdATgb0ZCHdA257tn25t9BeRrVqMbcSHF%2Fe%2B43tlfDLlPzc5WlZfkFjszX92zHSS5Lq7tC9fn3qDgzeKsoW9V8waP2oxgH6FD8U9jWZqidz2FxU8beB%2BNHhVWzUFGL%2B2o6qvo7MxNc099TWmlVE95mr7Ubu9AevD5mHxyMN42FMIeB2ARd0xBZ%2FD0AHDWHBWj5oMWpuy83UNE66w%3D--hMCIIgPEVKv6Eniv--1qQ1DjeVWmn2%2BxqOpGMksQ%3D%3D" ], "Host": [ "3iku9itbbb.execute-api.us-east-1.amazonaws.com" ], "Origin": [ "https://lamby-ws.custominktech.com" ], "Pragma": [ "no-cache" ], "Sec-WebSocket-Extensions": [ "permessage-deflate; client_max_window_bits" ], "Sec-WebSocket-Key": [ "mnACBiGQM/8M+Wt3ftwKVQ==" ], "Sec-WebSocket-Protocol": [ "actioncable-v1-json, actioncable-unsupported" ], "Sec-WebSocket-Version": [ "13" ], "User-Agent": [ "Amazon CloudFront" ], "Via": [ "1.1 dfbe3a6f5b354f9a5f95a5a6814ce14e.cloudfront.net (CloudFront)" ], "X-Amz-Cf-Id": [ "SM51fkUtGtL-3Xd3DxYpc8YxxYV5YtUT3ySVBUdEC_NlWj1diQehPA==" ], "X-Amzn-Trace-Id": [ "Root=1-6439884a-78ce49cc6150826e3b1b29ff" ], "X-Forwarded-For": [ "98.166.4.233, 130.176.179.72" ], "X-Forwarded-Host": [ "lamby-ws.custominktech.com" ], "X-Forwarded-Port": [ "443" ], "X-Forwarded-Proto": [ "https" ] }, "requestContext": { "routeKey": "$connect", "eventType": "CONNECT", "extendedRequestId": "DYI7wFpqoAMFfmQ=", "requestTime": "14/Apr/2023:17:07:22 +0000", "messageDirection": "IN", "stage": "cable", "connectedAt": 1681492042962, "requestTimeEpoch": 1681492042967, "identity": { "userAgent": "Amazon CloudFront", "sourceIp": "130.176.179.72" }, "requestId": "DYI7wFpqoAMFfmQ=", "domainName": "3iku9itbbb.execute-api.us-east-1.amazonaws.com", "connectionId": "DYI7wedwIAMCKgg=", "apiId": "3iku9itbbb" }, "isBase64Encoded": false }{ "clock_diff": 1681486457423, "deadline_ms": 1681492072985, "aws_request_id": "d6f5961b-5034-4db5-b3a9-fa378133b0f0", "invoked_function_arn": "arn:aws:lambda:us-east-1:576043675419:function:lamby-ws-production-WSConnectLambda-5in18cNskwz6", "log_group_name": "/aws/lambda/lamby-ws-production-WSConnectLambda-5in18cNskwz6", "log_stream_name": "2023/04/14/[$LATEST]55a1d458479a4546b64acca17af3a69f", "function_name": "lamby-ws-production-WSConnectLambda-5in18cNskwz6", "memory_limit_in_mb": "1792", "function_version": "$LATEST" }Default
{ "requestContext": { "routeKey": "$default", "messageId": "DMD1edEHoAMCJog=", "eventType": "MESSAGE", "extendedRequestId": "DMD1eEUSIAMFoEQ=", "requestTime": "11/Apr/2023:01:09:41 +0000", "messageDirection": "IN", "stage": "cable", "connectedAt": 1681175313769, "requestTimeEpoch": 1681175381974, "identity": { "sourceIp": "98.166.4.233" }, "requestId": "DMD1eEUSIAMFoEQ=", "domainName": "3iku9itbbb.execute-api.us-east-1.amazonaws.com", "connectionId": "DMDq0cY1IAMCJog=", "apiId": "3iku9itbbb" }, "body": "{\"hello\": \"there\"}", "isBase64Encoded": false }{ "clock_diff": 1681163961062, "deadline_ms": 1681175417127, "aws_request_id": "2e785761-dd73-4cd6-8679-3a1c29b96b58", "invoked_function_arn": "arn:aws:lambda:us-east-1:576043675419:function:lamby-ws-production-WSDefaultLambda-dUMtdfelRbcl", "log_group_name": "/aws/lambda/lamby-ws-production-WSDefaultLambda-dUMtdfelRbcl", "log_stream_name": "2023/04/11/[$LATEST]817ab291cb5e447e9b01e562f6d97ca1", "function_name": "lamby-ws-production-WSDefaultLambda-dUMtdfelRbcl", "memory_limit_in_mb": "1792", "function_version": "$LATEST" }Disconnect
{ "headers": { "Host": "911769d0hb.execute-api.us-east-1.amazonaws.com", "x-api-key": "", "X-Forwarded-For": "", "x-restapi": "" }, "multiValueHeaders": { "Host": [ "911769d0hb.execute-api.us-east-1.amazonaws.com" ], "x-api-key": [ "" ], "X-Forwarded-For": [ "" ], "x-restapi": [ "" ] }, "requestContext": { "routeKey": "$disconnect", "disconnectStatusCode": 1005, "eventType": "DISCONNECT", "extendedRequestId": "DD8hNHmSIAMF8MA=", "requestTime": "08/Apr/2023:14:04:29 +0000", "messageDirection": "IN", "disconnectReason": "Client-side close frame status not set", "stage": "cable", "connectedAt": 1680962664455, "requestTimeEpoch": 1680962669864, "identity": { "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.4 Safari/605.1.15", "sourceIp": "98.166.4.233" }, "requestId": "DD8hNHmSIAMF8MA=", "domainName": "911769d0hb.execute-api.us-east-1.amazonaws.com", "connectionId": "DD8gXeoaIAMCI9A=", "apiId": "911769d0hb" }, "isBase64Encoded": false }{ "clock_diff": 1680958928478, "deadline_ms": 1680962710403, "aws_request_id": "1499e91f-9bdc-4a79-9171-d96475ebcc5d", "invoked_function_arn": "arn:aws:lambda:us-east-1:831702759394:function:lamby-ws-production-WSDisconnectLambda-N9Ttmjd66gnN", "log_group_name": "/aws/lambda/lamby-ws-production-WSDisconnectLambda-N9Ttmjd66gnN", "log_stream_name": "2023/04/08/[$LATEST]107ded668c8e4edebde1c36756afa34b", "function_name": "lamby-ws-production-WSDisconnectLambda-N9Ttmjd66gnN", "memory_limit_in_mb": "1792", "function_version": "$LATEST" }Tailscale Lambda Extension for Containers:

How would I go by using/implementing websocket with this? Would action cable work or should a different approach be used? WIP Application: https://github.com/customink/lamby-ws