Handling Custom Protocols - custom-protocol

I'm looking to respond to an event from a web browser, hopefully any web browser. I'm working solely on windows and I came to the conclusion a custom protocol (I.E. myprot://collection/of/strings) is the best approach here (any objections?). But, handling an instance of this protocol seems to be a little less straight-forward. All I need is that collection of strings auto-magically passed to my already running application! (the app will only respond to these links while in a specific waiting state)
So answer me this, if you can, Whats the 'popular' method of handling them or better yet Whats the 'best' (subjective - I know) way to do it?
Although your answers don't need to be specific to my language, I am using Delphi for development.
Thanks!

Why not use the regular urls? http://localhost/myhandler/collection/of/strings. To the best of my knowledge custom protocols only work for IE and you still need to install the handler on the client computer.
In the past I used custom protocols in one of my projects to support laptops working offline, but it was back in the time when installing IIS on a laptop was a call for trouble. but now - what's the point?

Related

Writing a protocol that has client and server side software

I will be developing a protocol that will encompass a client and a server module.
Several protocols that are close to the one I have in mind exist, but I want to make something simpler with less overhead and with something I have more control on.
The protocol I will be doing can and will be run almost in any scenario, local, web, lan, internet, etc. It can also run on a single box.
My question is, how can I start developing for the server side of the protocol?
Any ideas, insights, key words, starting points would be appreciated.
Regards
Do you want to develop the protocol yourself and then use it? or you are looking for a good protocol to use?
If second, I have recently worked with "Websocket" protocol which enables clients to communicate with each other via a server. It is a really good protocol and there are libraries in .NET ( >= 4.5), JAVA, Javascript, ... It is also supported in many browsers.

How do I communicate with remote servers from an iOS application?

I want to create an application which can communicate with my central server database.
Example: One time registration for every user and I want to store registration data to my server database and show all users to show the list of all registered users.
What I have to do to implement this kind of thing?
You need to use NSURLConnection class to get this done. Alternatively, you can use ASIHTTPRequest, which, IMO, is much easier and user friendly. You can find ASIHTTPRequest here as well as detailed guide on how to set it up and use it: ASIHHTPRequest
Despite the advice you will get to use ASIHTTPRequest, or a variety of other frameworks that say they simplify networking, be aware that ASIHTTPRequest is no longer under active development.
If you are unsure about networking - just use the NSURLRequest/NSURLConnection path. It really isn't difficult to get up and running with it, and it works asynchronously with about 4 delegate calls. It's fast, built in, well integrated, well documented, and actively developed.
And, if in your application writing career, you think you might want to move on to using any other of these asynchronous networking wrappers, you'll be able to read the code, understand how they each handle different problems in different ways because you've had to face those problems while writing code yourself, and you'll be able to make an informed choice about which wrapper to use, rather than just picking one at random.

Any good client-server data sync frameworks available for iPhone?

I'm just getting into the client-server data sync stage of my iPhone app project, and have managed to get my CoreData data model loading on both the iPhone client and my TurboGears server (which is good). I'm now beginning to tackle the problem of sync'ing data between the server and multiple clients, and while I could roll my own, this seems like one of those problems that is quite general and therefore there should be frameworks or libraries out there that provide a good deal of the functionality.
Does anyone know of one that might be applicable to this environment (e.g. Objective-C on iPhone, pyobjc / Python on the server)? If not, does anyone know of a design pattern or generally-agreed upon approach for this stuff that would be a good road to take for a self-implementation? I couldn't find a generally accepted term for this problem beyond "data synchronization" or "remote object persistence", neither of which hit much useful on Google.
I did come across the Funambol framework which looks like it provides this exact type of functionality, however, it is C++ / Java based and therefore seems like it might not be a good fit for the specific languages in my project.
Any help much appreciated.
Since you are using TurboGears already, take a look at the RestController documentation. Using RESTful services has become a widely adopted architecture with many implementations for both clients and servers. Matt Gemmell's MGTwitterEngine is a good example of the client implementation of a specific API, Twitter.

iPhone Development - calling external JSON API (will Apple reject?)

Ok guys, so im new to iPhone development, so apologies if this is a silly question, but before i actually create my app i want to know if this is possible, and if Apple will reject this.
(Note this is all theoretical)
So i'd have a API (.NET) that runs on a cloud server somewhere and can return HTML/JSON/XML.
I'll have a website that can access this API and allow customers to do some stuff (but this is not important for this question).
I would then like my iPhone app to make a call to this API which would return JSON data. So my iPhone app might make a call to http://myapp/Foos which would return a JSON string of Foo objects. The iPhone app would then parse this JSON and do some funky stuff with it.
So, that's the background, now the questions:
Is this possible? (that is, call an external cloud API over HTTP, parse JSON response?)
What are the chances of Apple rejecting this application (because it would be calling a non-Apple API)
Are there any limitations (security, libraries, etc) on the iPhone/Objective-C/Cocoa that might hinder this solution? In regards to Security - can you freely make a HTTP (or even HTTPS call) from inside an iPhone app, and parse the response? In regards to libraries - is there sufficient support in Objective-C/Cocoa to accomplish this?
On this website, they seem to be doing exactly what im asking.
Thoughts, suggestions, links would be greatly appreciated...
Yes. It is possible. There are quite a few apps that do similar things.
Slim to none. Apple hinders what languages and libraries you can develop in and run on the phone. They won't limit you based on what external data you pull in to your app.
There shouldn't be any worries here either. You shouldn't run in to security concerns and there are plenty of libraries that you should be able to utilize to make your life much easier.
Good luck!
Yes it's certainly possible, and there are json parsers available already. Secondly, based on what you just described, should the application not break any rules outside of the scope of this question, then there is no reason I can see Apple rejecting it (except perhaps content, ie., don't display any porn or the like :)) ... Finally, you haven't properly described your application to fully answer #3, and I don't dare guess at what you meant, since it may be just a waste of your time. Feel free to expand on your #3 in comments, I'll answer there.
Edit: With regard to your edit of #3 above, yeah you won't have an issue here at all either.

iPhone Networking

If I have make an application, how would I make it interact with a database on a server of mine? I'm kind of lost, and don't know where to start.
Vague question yields a vague answer.
It entirely depends on what kind of interaction you need. Lots of constant queries? Few and far between? Client side cache? Real time updates? All of these questions will impact the answer.
The easiest way is to go with an AJAX style HTTP based client/server type of interaction. Sticking a database behind a web server has been done about a bazillion times and, thus, you'll find lots and lots of examples and, even, solutions with a few google searches.
You don't really need to use JavaScript (the J in AJAX). Instead, send over an HTTP request that encapsulates your query and have the server respond with an XML document containing the answer.
If that won't work for you -- too much overhead, need to relay binary information (for which XML sucks), etc.. -- then you'll wan to go with more direct access to the database. That is harder and can range from porting a client library to the iPhone to creating your own wire protocol.
A significantly harder problem and you'll have to deal with networking issues -- firewalls, NAT, proxies, etc... -- that are generally already solved with HTTP.
Stick with HTTP until you prove that it won't work. Much simpler.
Search for "http request" in the iPhone docs. HTTP client APIs are included.
You might try Apple's "Getting Started with Networking & Internet" or "Introduction to the URL Loading System", in addition to the Networking section of the iPhone Application Programming Guide. There are also several sample applications that handle networking of various types within the ADC's iPhone section.
Additionally, there are a number of open source iPhone applications out there that handle networking, including my own.
I had a similar question regarding a rails app - the answers there may help you.
What is the best approach for building an iphone client for a rails app?
But the answer really depends on your knowledge of iphone programming and server side programming, plus how your database is set up at the moment - but most likely you're going to need to write some kind of webservice / REST API that allows a remote client to do things with your database.
There are many frameworks available for that on the server side - if you're starting from scratch, ruby on rails may be a good choice.
On the iphone side, you'll probably want to start by reading up on NSURLConnection, and various request/response formats that you can use with it. I've found exchanging plists between the phone and server to be a pretty easy approach.