Skip to content

WebSocket-like communications over local UNIX sockets

Notifications You must be signed in to change notification settings

dkuzmenchuk/dk-socket-ipc

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Socket IPC

WebSocket-like communications over local UNIX sockets

Installation

$ npm install dk-socket-ipc

Creating a Message Server

var ipc = require('dk-socket-ipc')

var server = new ipc.MessageServer('/tmp/socket-loc')

server.on('message', function(message) {
  console.log('got message:', message.data)
  server.send('back at you: ' + message.data)
})

server.on('connection', function(connection) {
  console.log('client connected')
})

server.start()

Connecting To a Message Server

var ipc = require('dk-socket-ipc')

var client = new ipc.MessageClient('/tmp/socket-loc')

client.on('connection', function(connection) {
  console.log('connected. sending greetings...')
  client.send('greetings')
})

client.on('message', function(message) {
  console.log('got message:', message.data)
})

client.start()

About

WebSocket-like communications over local UNIX sockets

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%