It would be nice to support websockets as a transport layer with the network. I'm working on a fully cross-platform (Linux, Windows, OSX, Android, iOS, Web) client and I'd like the web version to use websockets. Would it be simple to do ?
Websockets may leak data. It鈥檚 a bad choice for secure messaging.
No websocket = no web client...
Or at least WebRTC
WebSockets are for client->server communications. You wouldn't be able to set up WebSocket server inside a browser, only a client.
WebRTC is for P2P applications, as it only gives you grief during bootstrapping. I did have partial success experimenting with WebRTC where you manually copy and paste the handshake info between two browsers, so any existing peer can be used for a connection set-up. But it's still a bit more complex than "Here's the address. Connect. Have fun". The matchmaking peer needs to relay about 3 packets before the direct connection is established. This has to be considered when handing off peers during bootstrapping, or even during normal operations.
@SlugFiller So it is technically possible, right?
@SkyzohKey Yes. There's even a library by Google for adding WebRTC to native apps. It would still be a heck of an undertaking, and basically be an extension to the protocol. And, as said, adjustment would need to be made for peer sharing to allow routing the WebRTC handshake if one of the peers is a WebRTC peer.
@SlugFiller Can you link that library please ?
@SkyzohKey https://webrtc.org/native-code/native-apis/
WebRTC leaks the IP of every computer connected to the network card interface.
@Atavic I'm aware of this, but Tox isn't an anonymity tool. Only a privacy one. + Web interface can be useful when traveling and you're one some free wifi. Not meant to be used as a main client. (See https://github.com/Tox-Client/client to understand why this is needed)
Any news about that ?
@iphydf I'm going to start implementing js-toxcore-c to my Tox client and I'd really like to have first class support of webrtc on the web version. Else I'll have to setup some sort of centralized server that does handle Tox DHT for every user that logs in, then relay packet with webrtc. But I'm not too friand of that way because ''centralized'' is against Tox's principles. We need to get Tox in the hands of as many users as possible and webapp is a great acquisition channel because it allows to try the IM before installing it. Also, every popular messenger as a web version, and we need at least feature parity with them of we want Tox to be successful :)
I'd be glad to help implementing this, but I'd need someone to bootstrap me, I'm not so good with C so...
@SkyzohKey I think you would have to somehow run toxcore in the browser?
I would have to implement the Tox protocol in JS, which I am willing to do, but for this to work toxcore needs to accept data from/to webrtc :)
@SkyzohKey you could also start to implement and run hybrid nodes to route data between normal c-toxcore and WebRTC toxcore, like https://github.com/webtorrent/webtorrent
@sudden6 that's an option but would be nice to have toxcore to handle that natively. But I light end using that ''hack'' until it's ready yes
Oh, and of course bootstrap nodes would need to handle signaling (webrtc to dht).
Optimally, the use of WebRTC would be a mostly transparent layer beneath the main Tox protocol, allowing any two clients to use whichever they can/prefer, similar to how TLS is used. An unfortunate major difference is that WebRTC needs a bridging side channel during handshake, which inevitably requires a protocol extension (unless you want to try to mess with REST-WebRTC hybrid).
I reckon what @SkyzohKey needs, currently, as a pointer to the file/functions in which the Tox protocol (particularly the handshake) is performed. Unfortunately, I haven't the time to delve into another code base. But if someone wants to point me to a file, I can probably give it a 10-15 minutes look to find the points of interest.
Any news about an web solution? - That would push tox to life again ;)
Most helpful comment
WebSockets are for client->server communications. You wouldn't be able to set up WebSocket server inside a browser, only a client.
WebRTC is for P2P applications, as it only gives you grief during bootstrapping. I did have partial success experimenting with WebRTC where you manually copy and paste the handshake info between two browsers, so any existing peer can be used for a connection set-up. But it's still a bit more complex than "Here's the address. Connect. Have fun". The matchmaking peer needs to relay about 3 packets before the direct connection is established. This has to be considered when handing off peers during bootstrapping, or even during normal operations.