What better way to celebrate 10 years of Xojo Cloud than bragging about all the things it can do! When you think of Xojo Cloud, you might think that it is for hosting Xojo web apps. And that’s true, Xojo Cloud continues to be the best and easiest way to host your Xojo web apps, but Xojo Cloud also offers several useful services for other types of apps.
iOS Notifications
Xojo Cloud can function as an Apple Push Notification system (APNs) for handling iOS push notifications. This works with Xojo and non-Xojo iOS apps. All Xojo Cloud servers are pre-configured to send remote notifications. Unlike many other cloud hosts, there is no extra charge for this feature nor is there any limit as to how many notifications you can send.
To send remote notifications from your iOS app you’ll need to go to the Apple Developer website to do these tasks:
- Add the Push Notifications feature to the App ID.
- Generate an Apple Push Services certificate.
In Xojo you need to enable the Remote Notifications entitlement for your app in the Capabilities section of the iOS Build Settings Advanced tab.
The final step is to upload your Push Services certificate using the Xojo Cloud control panel.
With super-easy access and no limits for notifications, Xojo Cloud can serve as a great APNs for handling your iOS notification needs.
Database Servers
Most desktop apps use a database of some kind and many are client/server database apps that talk directly to the database server. With Xojo Cloud you can host PostgreSQL or MariaDB/MySQL database servers and connect to them using an SSH tunnel for security purposes.
Setting up a database server on your Xojo Cloud is as easy as checking a box in the control panel.
You can turn on PostgreSQL or MySQL/MariaDB. If your Xojo Cloud server is large enough you could even do both.
If you want to access a database on Xojo Cloud from a desktop app, you will have to enable the SSH Tunnel and then connect to the tunnel from the computer. An SSH tunnel is a secure connection between your computer and another (in this case your Xojo Cloud server) which is used for transmitting data on a specific port. In essence, it creates a private connection through the internet which allows you to see into your server on the other end and connect to a particular service there.
To create a tunnel between a computer and your Xojo Cloud server, you first need to turn on the tunnel capability on your Xojo Cloud server. Go to your control panel and click the “SSH Tunnel” checkbox. You will be presented with a generated username and a password which you will use later for establishing the connection.
On macOS and Linux, you can use a terminal command to access the tunnel (replace username and ipaddress as appropriate; you’ll be prompted for the password).
Use this command to tunnel to PostgreSQL:
ssh -L 5432:localhost:5432 username@ipaddress -N
Use this command to tunnel to MySQL:
ssh -L 3306:localhost:3306 username@ipaddress -N
If you are using Windows, you will need to use an external app such as PuTTY. There are a number of tutorials available on the internet, just put “putty ssh tunnel” into your favorite search engine.
With the tunnel in place you connect to the database as if it were local to the computer. This works with anything, not just Xojo apps.
SFTP
Xojo Cloud offers SFTP (Secure File Transfer Protocol) for file transfer. SFTP is a secure variant of FTP which transmits files over the internet using strong encryption. That way you don’t have to worry about anyone intercepting your username and password or your files as they’re sent to or from your server.
When choosing a client, keep in mind that SFTP is different than FTPS or FTP w/ SSL. They are not interchangeable with one another.
Once you enable SFTP in the Control Panel, you’ll be presented with a dialog showing a generated username and password.
You can now connect using your favorite SFTP client. If you don’t have one, there are a number of free and paid options available including:
- ForkLift
- Transmit
- FileZilla
- CyberDuck
Having a place to store files online is always handy and can be useful when needing to share files with others without having to rely on services such as DropBox.
Web Services
OK, a web service is technically a Xojo web app but it is really an API that is meant to be used by other apps, often desktop or mobile apps. Since a web service doesn’t have any actual UI, you don’t really need to learn how to use the majority of the Xojo Web framework.
Instead you basically add code to the App.HandleURL event to route web service API calls to do specific tasks and then return the results, usually as JSON for the client app to handle.
A web service can be a great way to consolidate code that will be used by desktop and mobile apps, for example.
For example, you could create a Web Service that talks to a database server (such as one of the ones available in Xojo Cloud itself). Your Desktop and Mobile apps can use the same web service to work with the database. All your database-specific code lives in the web service and the client apps make requests and display results.
This is a very common design pattern these days and is a necessary one if you want a mobile app to talk to a database server.
If you want to learn more about web services, here’s a fun webinar to check out:
Learn more about Xojo Cloud today. Xojo Cloud servers start at $49/month, custom servers with more RAM, storage, and virtual CPUs are available. The best way to host your Xojo web apps is so much more than just hosting web apps!
Paul learned to program in BASIC at age 13 and has programmed in more languages than he remembers, with Xojo being an obvious favorite. When not working on Xojo, you can find him talking about retrocomputing at Goto 10 and on Mastodon @lefebvre@hachyderm.io.