Fixed ws id code

* Using a hash of the device + userid
* Remote IP is unreliable with proxy and websockets
* Reformatting code to collect private vs public for handlers