Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
signalr-client
Advanced tools
By: Matthew Whited (c) 2018-2020
This is a signalR client for node.js. The Intent of this project is to allow a node service to communicate with a signalR hub over websockets.
This project does not require jQuery but it also only support websockets. Fallback to other communication options such as long polling are not supported.
see signalR-sample.js for more examples
var signalR = require('signalr-client');
var client = new signalR.client(
//signalR service URL
"http://localhost:8080/signalR",
// array of hubs to be supported in the connection
['TestHub']
//, 10 /* Reconnection Timeout is optional and defaulted to 10 seconds */
//, false /* doNotStart is option and defaulted to false. If set to true
client will not start until .start() is called */
);
client.on(
// Hub Name (case insensitive)
'TestHub',
// Method Name (case insensitive)
'AddMessage',
// Callback function with parameters matching call from hub
function(name, message) {
console.log("revc => " + name + ": " + message);
});
//If you bind directly to the hub handlers as show here any previous
// handlers for that hub will be removed!
// hub name must be all lower case.
client.handlers.testhub = {
// method name must be all lower case
// function signature should match call from hub
addmessage: function(name, message) {
console.log("revc => " + name + ": " + message);
}
};
client.invoke(
'TestHub', // Hub Name (case insensitive)
'Send', // Method Name (case insensitive)
'client', 'invoked from client' //additional parameters to match signature
);
var hub = client.hub('TestHub'); // Hub Name (case insensitive)
hub.invoke(
'Send', // Method Name (case insensitive)
'hub', 'invoked from hub' //additional parameters to match called signature
);
client.call(
'TestHub', // Hub Name (case insensitive)
'Send', // Method Name (case insensitive)
'client', 'invoked from client' //additional parameters to match signature
)
.done(function (err, result) {
if (!err) {
console.log("call returned: ", result);
}
});
var hub = client.hub('TestHub'); // Hub Name (case insensitive)
hub.call(
'Send', // Method Name (case insensitive)
'hub', 'invoked from hub' //additional parameters to match called signature
)
.done(function (err, result) {
if (!err) {
console.log("call returned: ", result);
}
});
client.headers['X-MyTest-Header'] = 'Hello World!';
client.queryString.mVar1 = 'Hello World!';
Only support HTTP connections as this time
client.proxy.host = "127.0.0.1";
client.proxy.port = "8888";
These are all found under client.serviceHandlers
bound: void function(){}
connectFailed: void function(error){}
connected: void function(connection){}
connectionLost: void function(error){}
disconnected: void function(){}
onerror: void function(error){}
messageReceived: bool function(message){ return true /* if handled */}
bindingError: function(error) {}
onUnauthorized: function(res) {}
reconnected: void function(connection){}
reconnecting: function(retry) { return false; } */
client.serviceHandlers.connected = function(connection) {
/* connection: this is the connection raised from websocket */
}
client.serviceHandlers.messageReceived = function(message) {
/* message: this is the raw message received on the websocket */
return true/false; //if true the client handler for the hub will not be raised.
//if false the client handler will be raised.
}
client.serviceHandlers.onUnauthorized = function (res) {
//Do your Login Request
var location = res.headers.location;
var result = http.get(location, function (loginResult) {
//Copy "set-cookie" to "client.header.cookie" for future requests
client.headers.cookie = loginResult.headers['set-cookie'];
});
}
client.serviceHandlers.reconnecting = function (retryData) {
/* retryData: { inital: true (first retry)/false (following retries),
count: retry count } */
return true; // Abort retry
return false; // Retry
}
_Donations for this project are graciously accepted by paypal matt@whited.us
FAQs
signalR client for node.js
The npm package signalr-client receives a total of 3,090 weekly downloads. As such, signalr-client popularity was classified as popular.
We found that signalr-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.