I want to listen to the event from a service provider. So, I decided to use the target URL to listen to the events, while the app install event I am getting the target URL. I want to send the event to the Frontend(app.js) through the socket.
But I can’t integrate the same in server.js. How to implement the socket.io in server.js to emit the event to app.js? also, I need to connect to the target URL from app.js.
AFAIK, serverless functions cannot open sockets for incoming connections. They run on AWS lambda and will exit in 20 seconds. For your particular use case, you might have to use a separate PubSub service or set up a server to handle socket connections.
Thanks for the answer, @ashwins93!
Yes, as Ashwin mentioned, the Serverless functions will not run forever. For Socket connections, the server has to always run to let the client connect to it whenever it is opened. So, a separate server has to be setup to handle the socket connections reliably.
@Dineshkumar_Ravichan Could you briefly describe your use-case so we could understand this better? Ideally, you should be able to use the targetURL to create a webhook with the 3rd party service and receive events through our External Events feature. Do let us know if this does not fit your use-case.
@satwik, As you mentioned we are getting the event in target URL thru External Events. We have to push the same to the app.js thru the socket.
@Dineshkumar_Ravichan Since reliable Socket connection is not possible from Serverless app, it might need any additional platform feasibility to send messages to frontend app from the Serverless app upon receiving external events.
I will record it as a feedback and let our team consider a feature addition to add to our platform to send messages from Serverless app to frontend app.