3

I've been researching for many hours, but haven't found a definite answer. Is it possible for a client to connect to a hidden service with websocket? If so, how can I learn more? If not, is there an alternative that will allow socket communication besides http from a client to a Tor hidden service?

3

I have not used or tested it myself, but there are .onion sites that use web sockets, and there is no reason why it should work any different than with a normal, non-hidden site. Your web server must support it tho and clients must enable javascript.

This may be useful as an example: http://chattorci7bcgygp.onion/
With javascript disabled, it says: Unfortunately, you must enable JavaScript to use this website becuase [sic] we use web sockets. You can review our only JavaScript file _here_ if you have any concerns. (Click the 'here' link to look at the javascript.)

  • If a socket has a direct connection with a client, how does it work when the exit IP and tor route keep changing every few minutes? – chovy Jul 30 '16 at 2:35
2

As someone who has used web sockets for their hidden service, it is definitely possible. Here are a few pieces of advice:

  1. Web sockets absolutely will not work without JavaScript. Make sure that your JavaScript is clean and readable if you want people to actually use your service.
  2. Use NGINX over Apache. The proxy module for NGINX is mush faster than Apache's. When you add the potential slowness that comes with using tor, timeouts may become a reality.
  3. Make sure that the web socket has a plan for unicode. People will try speaking in Russian, Korean, Arabic, etc. If your web socket isn't expecting unicode, it may crash.

Other than that, web sockets over tor are no different from hosting a web socket on the clearnet.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy