Jump to content

websocket authentication


robl

Recommended Posts

Hi All, per the websocket docs, I placed the websocket sample file onto ISY and it works when I run http://isy.laddish.net/user/web/mydir/websock.htm

I have my own rPi apache server used for more complicated things. I'd like to load html page with complex JS that auto-update to changing events, and it seems websockets would be perfect. 

But ... I'm hung up on authentication. It seems that since the source of the HTML matters, even though it's running in my tablet. If the source html file comes from ISY, it looks to work, if from somewhere else, it fails. There is a big section in the docs for an Apache proxy server to ISY. Seems overkill to me, I don't want to tunnel requests through apache to ISY, I simply want to call ISY directly from a client on the local LAN and authenticate.

Has anyone else found a simple way to authenticate to isy for web sockets? Or is the apache proxy a must to make this work?

Thanks!

Rob

Link to comment

Thre are no websocket client libraries that allow authentication to be added. It’s not an ISY limitation - but a JavaScript/websocket limitation.

The only ‘solution’ is to host the html on the same hostname that the websocket connection will be made to - and rely on the browser passing a cached credential when connecting the websocket after prompting the user for authentication in the main browser session.

If not hosting the html on ISY, then a reverse proxy is needed to cause the browser to see both under the same host name.

Link to comment
  • 2 weeks later...

@MWareman, thank you for the great explanation. Seems like a gap to me in the standard. I'd hope there would be workarounds where ISY could host a javascript file that creates the websocket, and then include that from my rPi dynamic html, but imagine even if it does work, it'd likely run afoul of the cross-site scripting checks. 

For me it's very dynamic content, html created from a perl script, after it's read all my ISY devices, and formatted the output into custom report tables. Beyond the capabilities of ISY. I sometimes wish ISY ran on a rPi open platform. :) 

I'll check out the reverse proxy, thank you for your help!

Link to comment
7 hours ago, robl said:

@MWareman, thank you for the great explanation. Seems like a gap to me in the standard. I'd hope there would be workarounds where ISY could host a javascript file that creates the websocket, and then include that from my rPi dynamic html, but imagine even if it does work, it'd likely run afoul of the cross-site scripting checks. 

For me it's very dynamic content, html created from a perl script, after it's read all my ISY devices, and formatted the output into custom report tables. Beyond the capabilities of ISY. I sometimes wish ISY ran on a rPi open platform. :) 

I'll check out the reverse proxy, thank you for your help!

UDI reported they investigated using an RPi for ISY in the future but there are some licensing concerns that inhibited the idea from developing any further. It seems RPi isn't as open as people think.

Link to comment
4 hours ago, larryllix said:

UDI reported they investigated using an RPi for ISY in the future but there are some licensing concerns that inhibited the idea from developing any further. It seems RPi isn't as open as people think.

RPi as a closed system or UDI not wanting to go open source?

Link to comment

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...