Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including ng-sb-communication with all npm packages installed. Try it out:

var ngSbCommunication = require("ng-sb-communication")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

ng-sb-communication v5.0.1

A communication library for communication libraries


SB-Communication is a base communication low-level library meant to be used in other communication libraries. It allows promise-based communication on both ends, You must write a wrapper for it for your use-case specific stream, socket or resource though. It works in both browsers and node!

Example Communication Implementation

'use babel'

import Communication from 'sb-communication'

const worker = new WebWorker('worker.js')

const communication = new Communication({
  listener(callback) {
    worker.onmessage = callback
  send(data) {
    worker.postMessage = data

// Event-Specific bindings
communication.on('count-pi', async function(data) {
  // ^ Handlers can return Promises or be sync
  return 'Something else'


export default class Communication {
  constructor({ listener: Function, send: Function })
  on(event, callback)
  send(event, payload)


This project is licensed under the terms of MIT License.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free