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

node-muse

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-muse - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

.gitmodules

4

package.json
{
"name": "node-muse",
"version": "1.0.0",
"version": "1.1.0",
"description": "An event driven OSC message receiver for the Muse Brainwave Band made with Node.JS.",

@@ -26,3 +26,3 @@ "main": "src/index.js",

"dependencies": {
"osc": "^1.1.0",
"osc": "^2.0.1",
"tree-kill": "^0.1.1"

@@ -29,0 +29,0 @@ },

@@ -5,5 +5,5 @@ # Node Muse

> An event driven OSC message receiver for the Muse Brainwave Band made with Node.JS.
> An NPM module which provides an event driven OSC message receiver for the Muse Brainwave Band.
This module will create a server which automatically connects to the Muse, keeps the connection open and reconnects if necessary.
This NPM module will create a server which automatically connects to the Muse, keeps the connection open and reconnects if necessary.
During the open connection the server will receive all of the signals the Muse has to offer and translates them to neat little strings and objects.

@@ -106,2 +106,2 @@ The open server offers an observer type pattern, allowing the user to subscribe to these signals in an event driven way.

As seen here: [GPLv3 License](./LICENSE)
As seen here: [GPLv3 License](./LICENSE)

@@ -171,2 +171,10 @@ /**

// On unexpected error
self.childspawn.on('error', function(data) {
// TODO: Catch unexpected error
if(self.debug){
console.log(data);
}
});
// On unexpected close

@@ -173,0 +181,0 @@ self.childspawn.on('close', function(data) {

@@ -66,3 +66,3 @@ /**

// Create an osc.js UDP connection
// Create an osc.js UDP connection to receive incoming OSC data
this.udpPort = new osc.UDPPort({

@@ -75,3 +75,16 @@ localAddress: options.host,

this.udpPort.on("data", function (data, info) {
self.emit("data", osc.readMessage(data), info, data);
// Prepare an error for when the try catch fails, inside the try this variable will get overridden
var receivedData = {
address : "error",
args : ["The header of an OSC packet didn't contain an OSC address or a #bundle string"]
};
try {
receivedData = osc.readMessage(data);
} catch(e) {
if(self.debug) {
console.log(e);
}
}
self.emit("data", receivedData, info, data);
});

@@ -82,3 +95,3 @@

if(self.debug) {
console.log("OSC connection opened at: " + self.host + ":" + self.port);
console.log("OSC connection opened at: " + options.host + ":" + options.port);
}

@@ -85,0 +98,0 @@ });

@@ -73,4 +73,6 @@ /**

Muse.init({"not": "a", "valid":"argument"});
var spawnArgs = Muse.childspawn.spawnargs[2].replace("osc.udp://", "").split(":");
expect(spawnArgs[0] === "127.0.0.1" && spawnArgs[1] === "5002").toBe(true);
if(typeof Muse.childspawn.spawnargs !== "undefined") {
var spawnArgs = Muse.childspawn.spawnargs[2].replace("osc.udp://", "").split(":");
expect(spawnArgs[0] === "127.0.0.1" && spawnArgs[1] === "5002").toBe(true);
}
});

@@ -77,0 +79,0 @@ });

@@ -44,2 +44,33 @@ /**

});
});
describe("OSC emit messages:", function() {
var oscClass = require("../../src/server/osc.class.js"),
OSC = new oscClass();
beforeEach(function(){
// Disable console messages
OSC.debug = false;
spyOn(OSC, "emit");
OSC.init();
});
afterEach(function(){
OSC.destroy();
});
it("should emit a ready message when the OSC module says it's ready.", function() {
OSC.udpPort.emit("ready");
expect(OSC.emit).toHaveBeenCalledWith("ready");
});
it("should emit a message when receiving data.", function() {
// This arraybuffer contains a /muse/eeg address
// Caught from the actual muse data
var arrayBuffer = new Uint8Array([0x2f, 0x6d, 0x75, 0x73, 0x65, 0x2f, 0x65, 0x65, 0x67, 0x00, 0x00, 0x00, 0x2c, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x44, 0xc5, 0x32, 0x28, 0x43, 0xd1, 0xbc, 0x29, 0x44, 0xa7, 0x95, 0x16, 0x43, 0xd1, 0xbc, 0x29]);
OSC.udpPort.emit("data", arrayBuffer);
expect(OSC.emit).toHaveBeenCalledWith("data", jasmine.objectContaining({address: "/muse/eeg"}), undefined, jasmine.any(Object));
});
});

Sorry, the diff of this file is not supported yet

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