Gateway.js documentation

Started by rd909, March 09, 2017, 05:12:23 PM

rd909

I have been trying to learn more about nodejs and socket.io, specifically how gateway.js uses them. I would like to integrate the gateway with homebridge, and I think using something like homebridge-websocket might enable this. I am not a programmer, but know a fair amount about Linux and systems in general, and I can understand most of the code but could use some help putting it all together in my head. I have been testing with API.js from another thread, which is a REST-ful implementation, but it doesn't have the real-time updates of socket.io so I am thinking it would be best to interface directly with that for things like garagemote. Anyway, here is what I am wondering:

1. How do I interface with socket.io that is created by gateway.js? Is it localhost:8080?
2. Do I just need to pass json-formatted requests to that socket? I have tried this with curl, but it doesn't work so I am unsure of how to use it.
3. What commands are available via gateway.js? For example if i wanted to probe garagemote, how would I do that via socket.io?

Gateway is awesome and I understand how to expose it via my firewall to enable direct interaction with my moteino network, but HomeKit/homebridge would eliminate the need to expose it to the internet and (ostensibly) be more secure. Plus, it would be easier for my wife and kids to use. Anyw help is appreciated! Thanks

Felix

Hi rd909,

I am not really sure I can give the best answers to your questions, since I haven't tried to interface outside of the user interface that I built.
The socket is accessible through socket.io at port 8080. It expects plain text as seen in the gateway configuration. However nginx is setup to only accept requests through the http proxy (port 80) for security reasons, so you may not be able to directly hit the socket at 8080 for that reason.

The various endpoints for various commands may take json, there is no documentation to explain each except in the code and any comments.

The software is free and WYSIWYG, anyone is welcome to contribute and I will try to assist and answer questions.