Fork me on GitHub

SockIt · Home

Download



Home · Quick Tutorial · Full Tutorial · Demos · API · Source Documentation · Developers

Introduction

SockIt is a browser plugin that allows Javascript to perform asynchronous, low-level networking functions. The API allows web developers to create servers and clients which perform asynchronous network I/O by using Javascript events to perform callbacks. The API provides access to both TCP and UDP protocols, as well as basic concurrency control for tweaking performance.

First, load the plugin:

    var sockit = loadSockitPlugin();
Create a new client to connection google.com:
    var client = sockit.createTcpClient("www.google.com", 80);
Now, we register our client to alert us when it receives a response and send a GET request across the wire:
    client.addEventListener("data", function(event) { 
        console.log(event.read());
    });

    client.send("GET / HTTP/1.0\n\n");
And with six lines of javascript, we've created a simple TCP client. See it in action here.

Security Considerations

Installing this extension would give any web-page the permissions to make arbitrary TCP/UDP connections from your machine. Treat this as an experimental tool.

Installation

The plugin is currently packaged for Chrome and Firefox on Windows, Linux. and Mac OSX. To install the plugin, visit the downloads page.

Features

The plugin allows creation of TCP and UDP clients and servers, exposes a basic API for controlling each, and allows developers to perform asynchronous I/O with this clients and servers using Javascript event callbacks. Likewise, the API allows some concurrency control to improve performance, provides hooks to handle additional events such as errors, connection, disconnection, and asynchronously logs errors on the client machine for debugging.

Tutorials

To see a quick example of the plugin, see the quick tutorial or full tutorial.

To learn about everything that the plugin can do, see the API documentation.


Home · Quick Tutorial · Full Tutorial · Demos · API · Source Documentation · Developers