How much difference will using HTTP or TCP make?

I am making a gamer server for an ipad,iphone application. It is a two-player card game but there could be multiple games going on between any two players.

After going through a lot of forums and blogs, I decided to use nodeJS and mongo-db combination.

Now I am new to both but I have time to learn these things and I have a decent amount of experience in JS.

What I am not sure about is, If my client side is iOS and objective-C stack. What could be the best approach among TCP,HTTP with REST and WebSockets considering,

  • Reliable libraries avaliable.
  • complexity level
  • performance

In case you feel that I should not be using nodeJS in the first place itself, please point me towards the right direction as I am yet to start.

If you're considering using iOS, WebSockets are a no-go -- I'm sure you don't want to make your whole game out of a single big UIWebView.

TCP: well, that's an interesting question. Plain TCP has generally a smaller overhead than HTTP because of no avket headers/etc. are required, but implementing your own protocol is a much greater challenge that should be mecessary for writing a game and you'll end up with the same pitfalls that of HTTP with regard to speed/performance. Also, the BSD sockets API with which you can do TCP networking on Unix is not obvious to use at first glance. However, if you decide to use TCP, here's my OO wrapper for the API: http://github.com/H2CO3/TCPHelper

HTTP: ypu should probably choose it. It has a great history, it's a very mature protocol, and there are quite a few high quality C and Objective-C libraries out there for it. Cocoa (Touch) has the NSURL* kind of Objective-C classes and you also have libCURL for C.

On server side, you also might want to prefer HTTP as modern servers implicitly and automagically support it and you don't have to mess with the protocol to send a message, instead you simply say

<?php echo "Hello World"; ?>

Again, if you want to dig deeper, you can use WebSockets at server side if you deicde to use plain TCP.

I hope this will help.