5 ms·
HTTPKit — A lightweight HTTP server framework for Objective-C
- whalesalad 14y agoCan someone please explain the point of something like this? it's so verbose.
- deleted 14y ago[deleted]
- Zev 14y agoMaybe the author had a need for it, built it, and is throwing it out there for anyone else who might have a similar need? Maybe you need to embed a web server in your app for something? Maybe you're really comfortable with ObjC and just want to get a quick server up for prototyping? Maybe you don't find it to be too verbose, and prefer having code that's easily self-documenting instead of relying on framework knowledge? Maybe you like being able to use a framework like Foundation (which has had 20+ years of history)? And so on.
- whalesalad 14y agoEverything you've mentioned could possibly be a decent reason for this beast. I'd just love to hear what they were. You make something like this for one of two reasons. 1) you've got a lot of spare time on your hands and wanted to test your skills and show your love for a language. Based on the outlandish hello world example (which is useless for most web developers), this is most likely. 2) you had some ridiculous constraints and really absolutely had to build a web sever in objective-c. In this case, a better use case or example would be appreciated.
- fyolnish 14y agoIt was built in order to be able to create web applications in my scripting language called 'tranquil'. (And written in Objective-C to maximize performance) Here's the first web app to be written using it: https://github.com/fjolnir/experience-tranquility https://github.com/fjolnir/experience-tranquility
- mpweiher 14y ago3) You think that having a common language for all parts of your project could be an advantage, for example sharing your model code. Especially valuable if you've decoupled your model from your delivery framework like Uncle Bob told you ...;-) http://www.confreaks.com/videos/759-rubymidwest2011-keynote-architecture-the-lost-years http://www.confreaks.com/videos/759-rubymidwest2011-keynote-... 4) You find that the very small amount of spare time this sort of thing takes is worth it, even if just for kicks. 5) You miss WebObjects. 6) In addition to having code commonality, you might be interested in performance that allows you to not have to worry about scaling out for much much longer than other common solutions (or requiring rewrites if you're successful). For example, my own embedded Objective-C web lib (based on libmicrohttp) clocks in at around 30K requests/second even when initialized via script on my laptop, whereas something like Sinatra does around 900. http://blog.metaobject.com/2012/03/30k-requests-aka-wrk-is-fast.html http://blog.metaobject.com/2012/03/30k-requests-aka-wrk-is-f... http://blog.metaobject.com/2011/12/ruby-and-rails-scalability.html http://blog.metaobject.com/2011/12/ruby-and-rails-scalabilit... 7) You think textual verbosity is a good thing when it adds to readability. 8) You want to embed a web-server in your iOS and/or MacOS X app. Peer to peer, like the Internet was originally intended. While it may be possible to achieve with RoR or Sinatra or the like, an ObjC lib is just less hassle.
- nspragmatic 14y ago> 5) You miss pre-v.5 WebObjects FTFY :)
- mpweiher 14y agoThanks! Exactly what I meant :) In other words: there was a WebObjects after v4? ;-)
- fyolnish 14y agoThe point is fairly apparent. As for verbosity, I'm not sure how you would make it request handling less verbose than a single message send.
- SenorWilson 14y agoBuilding web frameworks is all the rage.
- jayfuerstenberg 14y agoI use my own HTTP server in my iOS app to export/backup the user's data (as a zip file) to a PC via browser. This means my customers needn't download a special app on their desktops and I don't need to write them.
- gilgoomesh 14y agoThe point? It's a light-weight embedded web server in Objective-C. If you need a web server embedded in your Objective-C app, then you can use it. As for verbosity -- Objective-C stylistically tends to be a little more verbose than other languages (named arguments, no abbreviations, verb-object structured method names). It doesn't need to be but it tends to be as a matter of tradition. That said, for what it's doing (setting up a web server with 3 different responses and error handling), this is not particularly verbose.
- carlhblomqvist 14y agoNeat, I like it!
- salimmadjd 14y agoThe OP also created a language on top of objective-C. Although I have no interest to learn any more languages, I have to applaude him. Objective-C could be clunky and his language Tranquil, takes some of the productivity of newer languages we've come to expect. Very cool!
- spearo77 14y agoThey also submitted it to HN a few months ago, but didn't get any comments – http://news.ycombinator.com/item?id=4386177 http://news.ycombinator.com/item?id=4386177
- zachwill 14y agoReally cool, OP. Looking forward to reading through this more thoroughly tomorrow, but I'm a big fan of these types of small side projects.
- pjmlp 14y agoHow well is it supported outside Mac OS X?
- fyolnish 14y agoIt should work on anything gnustep does. I do plan to make it compile with ObjFW, with which it would run pretty much anywhere. Without any hard to set up dependencies.
- mpweiher 14y agoIt should/will obviously also work on iOS, and using an Objective-C web-framework, your iOS device actually performs comparably to Ruby running on big iron. Imagine a server rack filled with old iPhones, or maybe a "server desk drawer" :-) While I don't know about this kit in particular, I've had good results with both Cocotron and GNUStep in getting ObjC/Cocoa code to Linux and Windows. Recently, I also had some Objective-C code running on my Android phone, but that sort of thing is experimental and not well-supported yet.
- pjmlp 14y agoMy tools have to be usable in all OS my customers require me to work on, hence my question.
- mpweiher 14y agoWhat other OSes do you require? GNUStep lists various BSDs, various Linuxes, HP/UX, Solaris, Windows and some embedded systems: http://wiki.gnustep.org/index.php/Platform_compatibility http://wiki.gnustep.org/index.php/Platform_compatibility I also had a large-ish system running on AIX.
- pjmlp 14y agoCurrently I only do job related work in C++, JVM and .NET. Never looked too much into GNUStep, because it is not clear to me how far Cocoa and the latest language changes from Apple are supported by gcc and clang + GNUStep. On my line of work it is the customers that decide the technology, not me, so they have a hard time thrusting Objective-C outside Apple's environment.
- sentinel 14y agoCould this be used as a method of communicating with an iOS device as if it were a server (e.g. sending updates from a real server to the iOS client (which now behaves like a server))? Somewhat of a replacement for notifications, perhaps?
- lucian1900 14y agoI doubt it, most mobile connections are behind NAT and/or firewalls, preventing one from connecting to devices.
- brendn 14y agoI used Mongoose [1] to do exactly that for devices that share a local network (auto-discovery and everything). So yes, it's definitely possible :) [1] http://code.google.com/p/mongoose/ http://code.google.com/p/mongoose/
- jawngee 14y agoThere is also: https://github.com/robbiehanson/CocoaHTTPServer https://github.com/robbiehanson/CocoaHTTPServer This works on Cocoa an iOS and supports: - Built in support for bonjour broadcasting - IPv4 and IPv6 support - Asynchronous networking using GCD and standard sockets - Password protection support - SSL/TLS encryption support - Extremely FAST and memory efficient - Extremely scalable (built entirely upon GCD) - Heavily commented code - Very easily extensible - WebDAV is supported too! (Not the author, just a user).
- fyolnish 14y agoHTTPKit does support WebDAV, Auth & SSL. But CocoaHTTPServer looks nice as well.
- brendn 14y agoI would love to see a LUA scripting framework built into this. I built an iOS app with an embedded web server, and dealing with dynamic text generation in Objective-C is a pain.
- fyolnish 14y agoYou'd be interested in one of my other projects, TLC then :) It's an objective-c bridge for lua, with which httpkit will work out of the box https://github.com/fjolnir/TLC https://github.com/fjolnir/TLC
- brendn 14y agoI'll have to try it out. Thanks!
- projectskillz 14y agoYes very cool love this also