#I need the lens to notify the web that something has been completed
7 messages · Page 1 of 1 (latest)
You would need to use remote API feature to get any info/event out from the lens.
Does it have to be a server? Is there no way to communicate with the page locally?
In my head I need some sort of socket system that can be notified whenever the lens triggers the server endpoint and that notifies the page itself but I feel like that's a bit overkill just to send a "hey, we're done"
Nope! With remote API, you can send trigger/data from lens to your front end and back without any server.
It is not web socket, so usually I will create a button in the lens, and use remote api to detect the button press on my front end.
But I think it is also possible to call the remote api every frame so you can simulate web socket.
do you have an example on how to set that up? when trying to setup a remote API it asks you for the host and the endpoints themselves, how can you make the remote API communicate with frontend??
This is the setup i have for my remote api. It detects a button press event from the lens to the front end. The host & provider name doesn't matter actually, as you can see in my screenshot. The only thing that matter are the Snap Kit app ID (or camera kit api token) and the end point name, which you will use in the lens.