Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Proxy all the seaports!

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 examples
Octocat-spinner-32 lib
Octocat-spinner-32 .gitignore
Octocat-spinner-32 LICENCE
Octocat-spinner-32 README.md
Octocat-spinner-32 browser.js
Octocat-spinner-32 index.js
Octocat-spinner-32 package.json
README.md

seaport-proxy

Seaport in the browser!

Client Example

var boot = require("boot")
    , seaport = require("seaport-proxy")

var ports = seaport(boot("/boot"))

var stream = ports.get("magic@1.2.x")
stream.on("data", console.log.bind(console, "[BROWSER]"))

stream.write("hello from browser!")

Create a client connection to the seaport server as long as the seaport proxy is running on the server.

Server example

var boot = require("boot")
    , seaport = require("seaport-proxy")

var ports = seaport.connect("localhost", 9093)

var sock = boot(ports)
sock.install(someHttpServer, '/boot')
console.log("sock hooked on", "/boot")

Creates a seaport proxy on the server so that the browser can talk to seaport.

Magic service

var seaport = require("seaport-stream")
    , net = require("net")

var ports = seaport.connect("localhost", 9093)

ports.service("magic@1.2.3", createMagic)

function createMagic(stream) {
    stream.write("hello from magic!")
    stream.on("data", function (data) {
        console.log("[MAGIC]", data.toString())
    })
}

Expose a service over seaport that the browser can talk to. Use seaport-stream because you don't care about the IO and only about the stream

Installation

npm install seaport-proxy

Contributors

  • Raynos

MIT Licenced

Something went wrong with that request. Please try again.