what is the url where the electron app is located?

Your approach is wrong. An HTTP server run inside your Electron app won’t generally be accessible to anything running outside of the user’s local network, so your Lambda function won’t be able to connect to it.

If you want to read notifications from a Lambda function, then you’ll need to poll it (make Ajax requests on a timer).

If you want to push messages from the server to the application, then you still need to initiate the connection from the client (so that the connection can be made outside of the user’s local network). The typical approach for this is to use Websockets. These are not Lambda function friendly though since they need to be Always On, so you would need to host a server listening for Websocket connections on some other system (like EC2). If your infrastructure is already geared up for Lambda functions then you could write one which, when triggered, sends a message to your EC2 server to trigger Websocket messages.

+-------+              +-------+                +-------+
|       |   HTTP       |       |                |       |
|   λ   |   Request    |HTTP   |   Websocket    |Client |
|       ----------------Server ------------------       |
+-------+              +-------+                +-------+

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top