title: Choice of transports for JSON over TCP
body: <p>I'm writing a simple streaming JSON service.  It consists of JSON messages, sent intermittently, for a long period of time (weeks or months).</p>
  
  <p>What is the best practise with regard to sending multiple JSON messages over a plain TCP socket? </p>
  
  <p>Some alternatives I have looked at (and their downsides) are:</p>
  
  <ol>
  <li>newline separated JSON - downside: newlines within JSON require escaping, or prohibition</li>
  <li>websocket inspired 0x00 0xff framing - downside: it's now binary, not utf-8 anymore</li>
  <li>real websockets - downside: lack of (opensource) websocket <em>client</em> libraries </li>
  <li>http multipart <a href="http://www.w3.org/Protocols/rfc1341/7_2_Multipart.html" rel="noreferrer">http://www.w3.org/Protocols/rfc1341/7_2_Multipart.html</a> - downside: incomplete client support?</li>
  <li>no delimiters - downside: chunking requires JSON parsing (can't just count curlies because of curlies in strings)</li>
  </ol>
  
  <p>Is there a good, or at least well-established way of doing this?</p>