Insomnia is an iPhone native application that, when enabled, will prevent the iPhone from sleeping, thus overriding its default behaviour. This allows background applications to continue to run and WiFi to work long after the screen has been switched off.

(The iPhone’s default behaviour is to sleep 30 seconds after the screen has gone off, when not docked and charging that is).