

Tether Launches HTML5-Based iPhone Tethering Solution - angkec
http://www.macrumors.com/2012/03/09/tether-launches-html5-based-iphone-tethering-solution/

======
st3fan
This is based on speculation and guesswork ... but this is what I think they
were doing with their original iTether application:

On the client (the Mac) they have a IOKit ethernet driver that shows up in
Network Settings. This becomes your default route (after some fake DHCP magic)
and then captures packets and relays them to their application that runs in
userland.

Their userland application contains a lightweight TCP/IP stack that interprets
those packets. (For example <http://www.sics.se/~adam/lwip/>)

The lightweight TCP/IP stack contains unimplemented callbacks for
opening/closing sending/receiving data. In this case those callbacks are
implemented as a higher level network protocol.

That 'wrapped' TCP/IP protocol is then relayed to the iPhone via the usbmux
protocol. This allows you to map a TCP/IP service on the device to a local
port on the Mac. (I happen to have written a nice usbmux proxy three years
ago)

So now the wrapped TCP/IP is arriving at the iPhone, in the form of higher
level 'network stack commands'. The iPhone app now simply has to interpret
these commands and translate them into real socket open/close read/write
commands.

At this point packets are flowing through a fake Ethernet device driver to a
secondary TCP/IP stack, over a USB cable to an iOS app which will do actual
socket calls and talk to the real network.

Soooo, my guess is that for this new app they use basically the same setup
except that the iOS app is gone and replaced with a simple web page with web
sockets that point to both that fake TCP/IP stack on the mac and to a hosted
proxy service on their end. Relaying data back and forth.

Crazy hack. Amazing it works :-)

~~~
saurik
Maybe it is just my warped perspective, but when I looked at the technology
this all came to mind immediately, but I just as immediately dismissed it
because of the "hosted proxy service": the fee was seemingly "too low".

So, I feel like you've left out the key non-obvious part: it turns out that
even if you do the brain-dead un-optimized "let's use Amazon EC2" for your
proxies, $30/yr at $0.05c/GB (down: up is free) buys 50GB/mo.

Given that the user is then going to be filing this data over their 3G
connections, 50GB/mo is (based on reports of users tethering that complain
about rate limiting and caps) at the very high-end of usage.

So, with that aside, the rest of this actually boils down to: "the webpage
just makes two outgoing websocket connections; one to a proxy, and the other
to an app on the PC, itself providing a custom network driver".

------
shankinson
Hey guys. I'm the developer behind this tech.

Glad to see it's got you thinking :). It took a lot of brainstorming and
testing/debugging to get this up and running.

Hope you enjoy it!

~~~
garindra
It did get me and I'm sure a lot of other people thinking. Would you mind
answering this Quora question that I set up so I can sleep tonight?

<http://www.quora.com/How-does-the-Tether-HTML5-app-work>

~~~
shankinson
I can't really go into much more detail than the first responder did without
getting into trouble :)

Let's just say it's magic.

~~~
falling
If that’s how it works it means that all my data is going through your proxy
server. Is that correct? Is the connection encrypted?

~~~
shankinson
Yes we have proxy servers. And yes the connection is encrypted

~~~
binarycrusader
What's to stop the carriers from simply blocking (or throttling) your proxy
servers? Or conversely, simply detecting which customers connect to your proxy
servers and automatically charging them for tethering (as they've already done
in other cases).

------
angkec
Ok so I went ahead and bought the service. Here's what I found out: You'll
have to keep the tether client application running on your Mac or PC. So not
gonna work for wifi-only iPads. Then you will need to keep the html5 webpage
open in order to receive data. They instruct you to set iPhone's screen lock
to "never" so it doesn't automatically shuts the web page down in 1 minute or
so. So I imagine you can't take phone calls when tethering as the webpage will
go offline.

Pricing wise, the first year costs $15 and will be $30 from second year on.
They set my paypal up for recurring payment.

Performance wise it's pretty fast on my iPhone 4. Setting up took about 2~3
min, very easy to do. The html5 app needs to connect to both the tether
website and the client computer. Took me a few tries to connect to both but
once they are connected the speed is pretty comparable to tetherme in
jailbroken iPhones.

~~~
moonchrome
>So not gonna work for wifi-only iPads

Excuse my ignorance of Apple products but how can tethering work on a device
without a internet connection ? You want to go trough a iPad proxy to get to a
WiFi connection ? Why not just connect to WiFi with the PC ?

~~~
Wilya
You could want to use the iPad as the client. Ie use an iPhone to give
internet connection to the iPad. (I guess that what the GP meant)

~~~
shankinson
Yeah, we almost have this working an know there is a huge demand for it. Still
a few technical hurdles to solve though.

------
thought_alarm
Wow. Cool hack.

But if you're friends with an iOS developer, you can ask him or her to build
an ad-hoc copy of iProxy for your iPhone and it won't cost you anything.

(Or get 100 of your closest iPhone-using friends to pitch in on an iOS
developer account)

<https://github.com/tcurdt/iProxy/wiki>

~~~
st3fan
Or jailbreak your phone and re-enable tethering.

~~~
thought_alarm
Nah.

------
Wilya
The way they do it is elegant, and could be used in many other places than
just the iPhone. All you need is a browser that supports websockets.

I'm not really aware of that stuff, but I'm a bit curious. Do websockets
really work over mobile networks (which are, at least in my experience,
transparent proxied, and where anything outside of HTTP-on-port-80/HTTPS-on-
port-443 is blacklisted into oblivion) ?

~~~
saurik
My experience is the exact opposite: all networks I've used in the US (Sprint,
Verizon, AT&T, and T-Mobile; in essence, all of the major ones) and the few
I've used in the UK (while roaming) have all had sufficiently few outgoing
ports blocked that I've never run into one (and I use my iPhone as if it were
a computer ;P). That said, WebSockets is just an upgrade extension to HTTP, so
it is going to go over 80/443 anyway.

~~~
jcitme
Same experience here. I use SSH over a wide variety of ports, and never had it
blocked by 3G before...

------
stephen_g
Do US carriers really still restrict tethering? That's really a shame, because
the iPhone's built in tethering support is very good, and extremely elegant
compared to apps and methods like this one...

~~~
masklinn
I found the exact same thing, especially since they (finally) implemented the
Access Point "tethering", it drains more battery but is incredibly convenient
and simple to setup.

Once upon a time, I used the very first iPhone proxy application (NetShare),
it was significantly more fiddly than native support. And of course you
couldn't use the phone while it proxied, that's not an issue with native
support.

------
smathieu
For a company that will be handling all of my web browsing, I would have
expected them to not store my password in clear text.

Doesn't inspire confidence :(

Great product idea though!

~~~
kenrikm
Disclaimer (I have not tried the new one) How do you know they store it in
clear text? Have you seen inside their database? I mean they could be
accepting the password in clear text but maybe they run it though a
MD5/Sh1/Salt process before it actually gets to the database.

------
robbiet480
How! That's what I really want to know. Streaming sockets?

~~~
guan
Would everything have to go through their servers? I can’t imagine that HTML5
apps on iOS have permission to open enough sockets to avoid that.

~~~
garindra
If everything has to go through their servers and then downloaded by the
Mac/PC, then it basically defeats the whole purpose of tethering.

The real trick is that they found a way to pipe data from the iPhone to the
Mac without going through the internet, all using a good ol' browser web page.

~~~
tedunangst
The question is how does the data get to the iPhone, and yes, it appears it
all goes through their servers.

------
mikebabineau
Looks like a great service, unfortunate that they're subject to the
HTML5/browser limitations (can't lock, etc).

Is there another way to distribute their native version besides through the
app store?

My company use TestFlight (<https://testflightapp.com/>) for iOS game
development. Is there anything similar, but better suited to end-user
distribution?

------
abalone
More fundamental than the "do they use websockets" question is "what is the
multihoming behavior of iOS?"

Sockets alone are not enough -- you need cooperation from the OS to route
connections over both wifi and cell data links in the desired fashion.

In this case we can infer it's two connections made by a script running on a
web page: one with the "tethered" machine (over wifi) and one with Tether's
proxy server (over cell data). The proxy server works in concert with a client
on the tethered machine, and the script just relays data between those two
connections.

The interesting thing is that iOS permits a single web page to connect over
both network links simultaneously. I'm no expert but that seems like something
Apple could, and would, kill with an update.

Really clever hack, though.

------
anonhacker
I feel like this is not so hard to do with NodeJS and Web sockets.

Small NodeJS app that serves the client connection webpage and acts as a
proxy. Set the proxy locally, When you get requests instead of fetching them
ask the socket for the data and headers.

On the client just do an XMLHttpRequest for whatever and shove it back down
the web socket to the proxy server. Done, Right? I'll do a little experiment
when i have time...

------
tonster
This is so cool! Like to see that even though they were rejected from the app
store they still went ahead and found a way to make their idea a reality.

------
cft
Too bad Android does not have any visible plans to implement WebSocket (which
is now RFC 6455). Perhaps the development of HTML5 apps on Android has lower
priority for Google than for Apple, to force the development effort into
native, which they can curate and control. This hypothesis is also
corroborated by comparing HTML5 performance in Android and in iOS (Android is
usually 300-500% slower).

~~~
notatoad
chrome for android supports websockets.

~~~
cft
Only on 4.0: it represents less than 1.5% of all Androids now. iOS had
Websockets since 4.1, for over 1.5 years. Unless Chrome gets back-ported to
Android 2.2 and 2.3 it will take a very long time.

~~~
RKearney
I thought 4.0 was supposed to stop that? iOS 5.1 runs on every iOS device
released in the last 3 years. When can we expect all Android devices released
in the past 2-3 years running the latest OS?

~~~
notatoad
when the carriers and handset manufacturers pull their collective thumbs out
of their asses.

~~~
spullara
Is that what had to happen for Apple to do it? I thought Android was on the
same carriers?

~~~
notatoad
god dammit, why does everything have to be an apple/android battle? can we not
complain about the deficiencies of android without some smug apple fanboys
chiming in? yes, apple is better at pushing out software updates than android
is. that's not relevant to a discussion on where we can and can't use
websockets. now go away.

~~~
spullara
Just trying to lay the blame where it belongs, on Google and the Android
ecosystem. You'd have your websockets if Google did the right thing and
enforced updates. Has nothing at all to do with the carriers .

------
sev
Very cool! Too bad the iphone can't lock, and that the wifi-only iPad can't
benefit from this.

On a side note, UI related, when I am on this page:
<http://tether.com/iphone/> and click "Order Now" at the top right, the modal
window opens behind the YouTube video.

~~~
shankinson
Thanks, I'll get our web dev guy to look into that.

------
yoda_sl
Interesting concept... Thinking about it, they are making Safari act as the
proxy/gateway. I did not dig into it but are they using web socket for
achieving that? I can see their desktop app, sending the request/proxying to
Safari which will in turns act the gateway to the net. Neat.

------
cyanbane
This sounds awesome, but please don't send my password back over email.

------
RandallBrown
I don't understand how this works. It seems like when you're connected to the
ad-hoc wifi network, all web requests would go through there. How do they get
around this?

~~~
rhplus
I'm assuming they're making use of the fact that the iPhone is multihomed when
wifi and cellular connections are both enabled. This means that any outboard
traffic from iOS _could_ take two routes, but the ad-hoc wifi network is only
advertising routes to IP addresses in a (predetermined) private address space.
So when the websockets app talks to a private IP address it choses the wifi
route and when it talks to a public IP address it choses the cellular route.

<http://en.wikipedia.org/wiki/Multihoming>

------
fuzzythinker
Why must I sign up in order to find out how much it cost?

~~~
shankinson
That's a good question. We'll change that.

------
rogerchucker
Can we expect any way to tether a Wifi-only iPad or iPod touch to this service
in future?

