Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
rxjs-ws-channels-filters
Advanced tools
Readme
RxJS implementation of websockets with channels and filters
var options = {
url: 'localhost:3000/api',
invalidUrl: function (e) {
// optional option if close event code is >= 1006 https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent
// this function will be called expecting a promise
// in the resolve of the promise the websocket connection will try again to connect with the url from the options
// in the reject of the promise the websocket observer will complete
return new Promise(function (resolve, reject) {
setTimeout(function () {
options.url = 'localhost:3000/api';
resolve(10);
}, 1000);
});
},
transformResponse: function (message) {
// transform the response from server
return message;
},
transformRequest: function (message) {
// transform the request sent to server
if (message.filters && message.filters.length) {
var i = message.filters.length - 1;
for (; i > -1; i--) {
message.filters[i].type = message.channel;
}
}
return message;
},
channelsMatch: function channelsMatch(source, target) {
// default function to find matching channels used for sending messages to the correct channel
// and to not have duplicate channels
// optional option, arguments ['existing channel', 'message channel']
return source === target;
},
filtersMatch: function filtersMatch(source, target) {
// default function to find matching filters used for sending messages to the correct filter
// and to not have duplicate filters on the same channel
// optional option, arguments ['existing filter object', 'message filter object']
if (target) {
for (var p in source) {
if (source[p] !== target[p]) {
return false;
}
}
return true;
}
},
// default options for actions
channelJoinAction: 'JOIN',
channelLeaveAction: 'LEAVE',
filterJoinAction: 'ADD',
filterLeaveAction: 'REMOVE',
notifyAction: 'NOTIFY'
};
var socket = new rxSocket.Create(options);
console.log(socket);
socket.channels.subscribe('one', function (message) {
console.log(message);
});
socket.channels.subscribe('one', function (message) {
console.log('secondSubscription to one');
console.log(message);
});
socket.channels.subscribe('two', function (message) {
console.log(message);
});
var filterSub = socket.channels.subscribeFilter('three', {id: 3}, function (message) {
console.log('filter', message);
});
filterSub.send('this is a message, from filter'); //send messages to server on this channel and filter
setTimeout(function () {
filterSub.unsubscribe();
var filterSub2 = socket.channels.subscribeFilter('three', {id: 4}, function (message) {
console.log('filter', message);
});
}, 5000);
FAQs
RxJS websockets implementation with channels and filters
The npm package rxjs-ws-channels-filters receives a total of 0 weekly downloads. As such, rxjs-ws-channels-filters popularity was classified as not popular.
We found that rxjs-ws-channels-filters 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.