Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

spacebro-client

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

spacebro-client - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

6

example/index-example.js

@@ -19,3 +19,7 @@ 'use strict'

]
actionList.push({name: 'new-media'})
spacebroClient.registerToMaster(actionList, 'example-bro')
spacebroClient.registerToMaster(actionList, 'example-bro')
setInterval(function () {
spacebroClient.emit('new-media', {data: 'foo'})
}, 2000)

17

index.js

@@ -6,8 +6,8 @@ 'use strict'

const _ = require('lodash')
let socket
function registerToMaster (actionList, clientName, zeroconfName) {
mdns.connectToService(zeroconfName || 'spacebro', function socketioInit(err, address, port) {
mdns.connectToService(zeroconfName || 'spacebro', function socketioInit (err, address, port) {
console.log('service found: ', address)
var socket = io('http://' + address + ':' + port)
socket
socket = io('http://' + address + ':' + port)
.on('connect', function () {

@@ -23,3 +23,5 @@ console.log('socketio connected to ' + 'http://' + address + ':' + port)

socket.on(action.name, function (data) {
action.trigger(data)
if (action.trigger) {
action.trigger(data)
}
})

@@ -31,3 +33,8 @@ }

module.exports = {
registerToMaster: registerToMaster
registerToMaster: registerToMaster,
emit: function (event, data) {
if (socket) {
socket.emit(event, data)
}
}
}
{
"name": "spacebro-client",
"version": "0.0.2",
"version": "0.0.3",
"description": "Allow to automagically 🌟 connect to a Spacebro server",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"example": "node ./example/index-example.js"
},

@@ -9,0 +10,0 @@ "repository": {

@@ -15,2 +15,3 @@ # Spacebro client

spacebroClient.registerToMaster(actionList, clientName, zeroconfName)
spacebroClient.emit('event', data)
```

@@ -37,2 +38,4 @@

Do not forget to add the event you want to broadcast to the actionList.
The clientName parameter is the name of you client. You will see it in the Spacebro log.

@@ -39,0 +42,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc