DISQUS

DISQUS Hello! toxicsoftware.com is using DISQUS, a powerful comment system, to manage its comments. Learn more.

Community Page

Jump to original thread »
Author

Is that an HTTP server in your Cocoa application or are you just pleased to see me?

Started by schwa · 10 months ago

This is a little 30 second/1.4MB screencast showing a little idea I had to embed a simple HTTP server inside a Cocoa application. The screencast just shows an application hosting a basic HTML form that allows someone browsing to the application’s address to modify the applications defa ... Continue reading »

7 comments

  • Very cool idea - currently for Cocoa Apps which I want to have an HTML front-end for I've worked with a Python Server with an XML socket connection to the app. But being able to directly hook into Cocoa code would be very nice.
  • I have done this quite a few times with PyObjC and Twisted.

    It is quite easy to embed Twisted into a Cocoa app via PyObjC. It is even possible to inject said solution into a Cocoa app that is already running.

    Because of the design of Twisted, the I/O happens on a thread, but the actual request handling happens in the main event loop. As a result, there is no need to deal with threading issues.

    Combined with Nevow and MochiKit, one can relatively easily develop rich web based clients to your Cocoa app's internals.

    I really should put a demo together.
  • Yeah Python (and by extension PyObjC) is great for things like this. But I had the code anyway and just needed to polish it up a tad and whip the demo up.
  • Great idea Jon -- I had actually considered something similar for Sandvox (though I had been thinking about custom URL schemes) but punted on it (for now at least) since webkit is so similar to viewing with Safari. Still, it would be cool just so people could see what their site would look like with another browser.

    Where I see the promise for your idea is for writing some interesting AJAX kinds of web applications in Cocoa.....
  • Maybe a job for a Sandvox plugin?
  • Very early betas of NetNewsWire actually embedded an http server. This was before Lite 1.0 shipped.

    It handled just one type of request, a request to subscribe to a feed. The idea was that people could put a button on their site that linked to a url like http://127.0.0.1:5335/subscribe?url=http://some... -- and the request would then go to NetNewsWire on your desktop, which would subscribe to the feed. Easy one-click subscribing.

    It wasn't my idea -- Radio UserLand was already doing this, and we figured we had to do the same thing.

    (But then there was the issue of how to manage two aggregators that want to listen to the same port -- and then more apps that would come along and want to listen on that port too. I decided to remove the http server before it became something to fight over.)

    But anyway -- I always thought the idea was interesting, that connection between web page and the desktop. (It doesn't have to be feed-subscribing, of course.)
  • Hi. So can you please provide the the code for that application? Would be really appreciated!

Add New Comment

Returning? Login