Hi!
I was going thru the raspberrypi home-automation gateway and got everything up and working. only with motion sensors instead of the garagemote. Im wondering if it is possible to have the index.php running on my webpage and still communicating with the gateway.js running on the pi? what changes would I have to make?
Quote from: snop on February 16, 2015, 04:50:18 PM
Im wondering if it is possible to have the index.php running on my webpage and still communicating with the gateway.js running on the pi? what changes would I have to make?
Doesn't it already do that?
You have a index.php that renders your webpage, and a gateway.js serving the back end.
Yeah, I'm sorry. I was takling about uploading the php to my webserver host, ftp.domeneshop.no and than communicate with the gateway on the pi.
You sure could, but you'd need to open the socket to the world and that opens up security issues, so you'd need to secure your socket.
Why would you want to do that?
Well, im really just experimenting a little bit before I decide how my project will look like. Are there many changes needed? wont I have to add som changes to the index.php also? so they can communicate over the web?
There are changes yes, but you are on your own if you want to experiment with it.
I will support and answer questions related to the setup I posted.
I would not do it the way you suggested since it's making it harder to maintain and implies more security that needs to be addressed or else it opens up security holes that could be dangerous.
Just the other day I was looking around at my Pi access logs and to my surprise I saw a hefty set of force attacks comprising of port scanning and dictionary access of URLs - things like admin/setup/config pages/files/urls. That was interesting and scary.
I suggest obfuscating the setup of your websocket and front end webserver as much as possible. Keeping the webpage on 1 server and the backend on another, separated by the internet, sounds like a really bad idea to me, unless there is a real use case or requirement, but I have yet to understand how that could be useful or how the benefit of such a setup would outweigh the disadvantages.