Move to new framework

I finally started to make the move from the classic framework to the new framework (out of necessity to use the HTTP v1.1 protocol).

So far so good. I have one question though, before I make any assumptions (you know what they say about assumptions).

Can I assume that all code written with the new framework will run as-is on all platforms, including iOS and Web?

Yep.

iOS of course, since all it has is the new framework. Web, I use Xojo.Net.HTTPSocket in my Paypal listner and it runs as clockwork.

If you don’t try to make it synchronous it is good IMHO. It also knows how to deal with proxies. Although kinda slow in Feedback Windows, but I know Greg has been working on a fix for some time.

Great.

I’ve also found that the Xojo.Net.HTTPSocket solved all my connection issues. I suspect proxies was the problem.

I do however use it “synchronously” at the moment. I wrote a wrapper function that is used as a drop-in replacement for the old socket that simulates synchronous requests. Unfortunately I have 2 rather large applications that cannot be completely redesigned at this point. In time I hope to refactor them for more optimized asynchronous calls.

My question was actually more broad… in that… is all code in the new framework portable to all platforms (not just the HTTPSocket socket code)?

May you please post a sample project for this function?

As soon as I’m back at my work PC I’ll post the code for you Richard.

That is the intent, although Xojo.Net.TCPSocket and Xojo.Threading are still iOS-only at this point.

Hi Richard,

You can grab the sample project here.

The method used in this project should only be used in extreme cases where rewriting/redesigning legacy code is simply not an option.

The proper way to use the new Xojo.Net.HTTPSocket would be to design your application architecture to make proper asynchronous calls.

I’m publishing it here because it does however serve as an intermediate fix for those who have large applications designed for synchronous requests, who needs to make calls using HTTP 1.1.

Thanks for the heads up Paul.

PS. The sample project above is not a complete drop-in replacement. It does not cater for error codes etc, and simply illustrates how to go about making synchronous requests using the new framework’s HTTPSocket.

UPDATE:

I’ve just uploaded a new version of the sample project to the link above that now also includes the methods “Post” and “SetFormData” for making synchronous posts.

Great - thank you Alwyn.

It seems that the Xojo.Net.HTTPSocket does not work in a thread???

Only on Windows.
Additional information, and bug report links are in this thread: https://forum.xojo.com/38656-will-we-ever-see-xojo-net-httpsocket-called-from-a-thread-work-

With regards to writing Android apps in Xojo, will Android apps also exclusively be written using the new framework, similar to iOS?

Yes. They stated they’d be using Interops to make this process faster.

Alwyn, keep in mind that you don’t have to move entirely to the new framework to use pieces of it. There is nothing to keep you from mixing, and in fact, it might be more efficient. For example, Text processing on Windows/Linux is slower than the Mac and, until it’s addressed, you might want to stick with Strings.

Thanks guys.

Mixing is the migration strategy I’ll have to use.

My projects are simply to large, and too close to release, to do any rewrites at this point. However, I also don’t want to get stuck in the classic framework, and miss out on learning about the new framework. I try to implement all new features using the new framework.

I have to admit, I’m starting to take a liking to the new framework, and the prospect if its code being so portable across mobile platforms is a big incentive to adopt it over the classic framework.