{
  "id": "4efbcabcc3ce",
  "url": "http://ajaxian.com/archives/tcpsocket-sockets-in-the-browser",
  "title": "TCPSocket: Sockets in the browser",
  "note": "Michael Carter of Orbited has written about how he now likes to call Comet sockets in the browser, and has an implementation available that looks like this:\n\nPLAIN TEXT\nJAVASCRIPT:\n\n\n\n\n\n\n\nvar conn = new TCPSocket(hostname, port)\n\n\n\n\n\nconn.onopen = function() { alert('connection opened!') }\n\n\nconn.onread = function(data) { alert('RECEIVE: ' + data) }\n\n\nconn.onclose = function(data) { alert('connection closed!') }\n\n\n\n\n\nconn.send('Hello World');\n\n\n\n\n\n\n\n\n\nThe above code code is all you need to know. It will open a TCP connection to hostname:port, and will send the data Hello World. Any data the server sends back will be alerted with the onread handler.\n\nThe exact mechanism behind this innovation is pretty straightforward: Orbited is a router and firewall for incoming TCPSocket connections from the browser. It uses Comet techniques to establish bi-directional communication with the browser, then forwards all data over a raw TCP socket to the end point. Configuration allows access control enforcement so that the TCPSocket can only be connected to pre-approved end-points, so that the Orbited server isnt an open relay.\n\nWhile this presents a paradigm shift in the way developers are tackling real-time, web-based applications today, its actually a return to the original method of writing network applications. Instead of writing applications based on web frameworks and throwing a Comet server in the mix, you can simply use the client-server architecture where the browser is the client, and the server is an arbitrary TCP server.",
  "voice": "excerpt",
  "saved": "2008-07-01T18:50:36Z",
  "host": "ajaxian.com",
  "kind": "page",
  "tags": [],
  "record": "https://links.thingelstad.xyz/links/4efbcabcc3ce/",
  "markdown": "https://links.thingelstad.xyz/links/4efbcabcc3ce.md",
  "issues": [],
  "connections": {
    "same_host": {
      "count": 13,
      "page": "https://links.thingelstad.xyz/hosts/ajaxian.com/",
      "nearest": [
        {
          "id": "65df26b3f9a3",
          "title": "Cross-Site XMLHttpRequest in Firefox 3",
          "url": "http://ajaxian.com/archives/cross-site-xmlhttprequest-in-firefox-3",
          "record": "https://links.thingelstad.xyz/links/65df26b3f9a3/"
        },
        {
          "id": "dd71d3010395",
          "title": "ProtoFlow: Coverflow for Prototype",
          "url": "http://ajaxian.com/archives/protoflow-coverflow-for-prototype",
          "record": "https://links.thingelstad.xyz/links/dd71d3010395/"
        },
        {
          "id": "da7d5d936929",
          "title": "IPhone WebKit Goodness: 3D CSS Transforms and ontouch events",
          "url": "http://ajaxian.com/archives/iphone-webkit-goodness-3d-css-transforms-and-ontouch-events",
          "record": "https://links.thingelstad.xyz/links/da7d5d936929/"
        },
        {
          "id": "c08cd2b88726",
          "title": "Steve Yegge on Server Side JavaScript",
          "url": "http://ajaxian.com/archives/steve-yegge-on-server-side-javascript",
          "record": "https://links.thingelstad.xyz/links/c08cd2b88726/"
        },
        {
          "id": "15765dda03d6",
          "title": "72photos: ProtoScripty Photo Sharing Site",
          "url": "http://ajaxian.com/archives/72photos-protoscripty-photo-sharing-site",
          "record": "https://links.thingelstad.xyz/links/15765dda03d6/"
        }
      ]
    },
    "same_week": {
      "count": 12,
      "nearest": [
        {
          "id": "3e8693e5333b",
          "title": "FriendFeed Finally Gets iPhone-Friendly",
          "url": "http://techcrunch.com/2008/06/30/friendfeed-finally-gets-iphone-friendly/",
          "record": "https://links.thingelstad.xyz/links/3e8693e5333b/"
        },
        {
          "id": "b767f38850e8",
          "title": "Microsoft Remote Desktop Connection 2 now available",
          "url": "http://www.tuaw.com/2008/07/01/microsoft-remote-desktop-connection-2-now-available/",
          "record": "https://links.thingelstad.xyz/links/b767f38850e8/"
        },
        {
          "id": "2e0808315e05",
          "title": "Microsoft releases Remote Desktop Connection Client for Mac 2",
          "url": "http://macdailynews.com/2008/07/01/microsoft_releases_remote_desktop_connection_client_for_mac_2/",
          "record": "https://links.thingelstad.xyz/links/2e0808315e05/"
        },
        {
          "id": "0c19e92e8ad2",
          "title": "Current iPhones Keep Cheaper Plan on Reactivation",
          "url": "http://tidbits.com/article/9680",
          "record": "https://links.thingelstad.xyz/links/0c19e92e8ad2/"
        },
        {
          "id": "cf8ea91b2d98",
          "title": "Digital Photography: Get Better Fireworks Photos This Fourth of July",
          "url": "http://lifehacker.com/397649/get-better-fireworks-photos-this-fourth-of-july",
          "record": "https://links.thingelstad.xyz/links/cf8ea91b2d98/"
        }
      ]
    },
    "mentions": [],
    "mentioned_by": [],
    "saved_twice": []
  },
  "elsewhere": {
    "wayback": "https://web.archive.org/web/*/http://ajaxian.com/archives/tcpsocket-sockets-in-the-browser"
  }
}
