
Research
/Security News
Weaponizing Discord for Command and Control Across npm, PyPI, and RubyGems.org
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
@oneflow/loopback-component-primus
Advanced tools
Primus adapter for loopback. It allows you to call loopback's remote methods via websocket.
Primus adapter for loopback. It allows you to call loopback's remote methods via websocket.
npm install --save @oneflow/loopback-component-primus
Add the loopback-component-primus component to the server/component-config.json
:
"@oneflow/loopback-component-primus": {}
A small change is needed in the server/server.js
file, replace:
app.start();
with:
app.server = app.start();
The primus client library is exposed at the URL http://<LOOPBACK_URL>/primus/primus.js
You will need to import it in your html:
<script type="text/javascript" src="http://<LOOPBACK_URL>/primus/primus.js"></script>
Then, in your code:
const primus = new Primus({
url: 'http://<LOOPBACK_URL>',
});
Now you will be able to call remote methods using primus.send('invoke', {...});
// Call prototype method:
primus.send('invoke', {
methodString: 'color.prototype.patchAttributes',
args: {
id: 1,
data: { name: 'black' }
},
}, function (err, data) {
if (err) {
return alert('Error from server: ' + JSON.stringify(err));
}
alert('Record updated: ' + JSON.stringify(data));
});
// Call static method:
primus.send('invoke', {
methodString: 'color.find',
args: {
filter: {
where: {
name: 'black'
}
}
},
}, function (err, data) {
if (err) return alert('Error from server: ' + JSON.stringify(err));
alert('Find results: ' + JSON.stringify(data));
});
Operation hooks will not work with the primus adapter (they work only with the REST adapter). We will use the global remote hooks that works seamless with all adapters. The syntax is slighly different:
app.remotes().before('user.*', function (ctx, next) {
console.log('methodString', ctx.methodString);
next();
});
app.remotes().before('**', function (ctx, next) {
console.log('methodString', ctx.methodString);
next();
});
You can find the spark
property, in the ctx
object.
FAQs
Primus adapter for loopback. It allows you to call loopback's remote methods via websocket.
The npm package @oneflow/loopback-component-primus receives a total of 2 weekly downloads. As such, @oneflow/loopback-component-primus popularity was classified as not popular.
We found that @oneflow/loopback-component-primus demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 23 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Research
The Socket Threat Research Team is tracking weekly intrusions into the npm registry that follow a repeatable adversarial playbook used by North Korean state-sponsored actors.