Sending a command via AWS Lamba to a Gitch server

Hey Community,

I am trying to figure out if I can trigger a Lambda function to send commands to a glitch server to emit commands to players from a glitch server. Does any one have any ideas?

Thanks
Alexis

You can’t use Lamba as you get a small part of a server. Or a container. You could use something like socket.io that uses websockets to talk to users and the server.

Can I post data to a server from Lambda that triggers an action on a Glitch server then? Thanks for enlightening me also.

1 Like

Probably…

You don’t have access to that. You only have access to files and console.

1 Like

I believe I communicated to another AWS server from lambda from an alexa skill using the urllib module of python 3. You should be able to use whatever networking http/ws libraries available for your language to communicate with a glitch server.

AWS Lamda are serverless functions, right?

@GariantrollFCB forgive me, but can you please explain a bit more detailed what you’re trying to achieve here? :slightly_smiling_face: :grimacing:

I am building an Alexa skill that controls a website. The problem is I currently have the client continuously checking the endpoint for updates every 2 seconds. My thought was may be I can use Alexa to alert the glitch server using socket.io instead, and the server would alert the client there was an update.

Alexis

I think this is possible as socketio uses the http protocol which based on my youtube playing alexa skill doesn’t seem to have any problems on AWS lambda. However if you a streaming media off a glitch server I don’t think it will work for some weird reason(alexa not like glitch cerificate?).

It is not a “Glitch server”. It is a container. You can’t connect to other Hlitch projects.

Hi GariantrollFCB,

I don’t know much about sockets and what these guys are talking about, but I ran a quick test to POST to a Glitch site from an Azure Function (equivalent to AWS Lambda) and it worked out fine.

If you’re ok sending data between your Glitch site and the Lambda using good-ol HTTP POST, then this could be for you.

In your Glitch project, if you’re using express, add the cors package as explained in this guide: https://medium.com/zero-equals-false/using-cors-in-express-cac7e29b005b

I set up a basic test endpoint like this:

app.post("/test", (req,resp) => {
  resp.json({"status" : "ok", "message" : "hello world!", "dogs" : 12});
})

Then in my Azure Function (Lambda), I set up Axios and made a simple request to the Glitch site:

const axios = require("axios");

module.exports = async function (context, myTimer) {
    const response = await axios.post('https://respond-external.glitch.me/test');
    context.log("Response", response.data);
};

And here’s the log showing it worked:

2020-11-12T10:43:35.677 [Information] Response { status: 'ok', message: 'hello world!', dogs: 12 }
2020-11-12T10:43:35.687 [Information] Executed 'Functions.TimerTrigger1' (Succeeded, Id=6aa9a4e0-a318-4b22-a051-caf87b4c7777, Duration=484ms)

I hope this helps! :smiley:

Lastly I’d like to remind some of the regulars that this is meant to be a kind and helpful forum, not a place for showing off what you know or nitpicking the terminology used by others! :blush:

1 Like

Thanks,

I can’t wait to try this out. I will report back on my success.

Alexis

Thanks for the information. I always appreciate the enlightenment.

Alexis

1 Like

Hey, this works pretty well. Just got back from vacation and jumped back into this project to good news.

Thanks

2 Likes

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.