Simple and fast websocket abstractions for server & client

npm install transmit

Transmit is two things:

  • Abstractions on top of the ws library
  • A similar set of abstractions for the client, automatically exposed
var express = require('express')
,   app = express.createServer()
var lactate = require('lactate').Lactate({
    expires:'two days'
app.get('/', function(reqres) {
  return lactate.serve('index.html', req, res)
var transmit = require('transmit')()
transmit.on('connection', function(socket) {
  socket.on('someEvent', function(data) {
    socket.send('someResponseEvent', {
<!doctype html>
    <title>Transmit example</title>
    <script src='/transmit'></script> 
      transmit.once('open', function() {
          transmit.on('someResponseEvent', function(data) {
            console.log('someResponseEvent!', data)
          transmit.send('someEvent', ':|')

To set ws options, you may pass them to the initialization function like so

var transmit = require('transmit')({port:2112})

You can find all of the available options here along with one exception: client_script. This option represents the name with which to expose the client script, by default, as shown in the above example, transmit.

var id = 'to_defy_the_laws_of_tradition_is_a_crusade_only_of_the_brave'
var transmit = require('transmit')({
    The script can now be accessed from