rxjs-ws-channels-filters
Advanced tools
Comparing version 0.0.5 to 0.0.6
@@ -85,3 +85,5 @@ 'use strict'; | ||
var channelSub = initChannel(channel); | ||
return channelSub.observable.subscribe(responseHandle); | ||
var subscriber = channelSub.observable.subscribe(responseHandle); | ||
subscriber.send = createChannelSenderFunction(channel); | ||
return subscriber; | ||
} | ||
@@ -123,3 +125,5 @@ | ||
function subscribeFilter(channel, filter, responseHandle) { | ||
return initFilter(channel, filter).observable.subscribe(responseHandle); | ||
var subscriber = initFilter(channel, filter).observable.subscribe(responseHandle); | ||
subscriber.send = createChannelSenderFunction(channel, filter); | ||
return subscriber; | ||
} | ||
@@ -155,2 +159,3 @@ | ||
} | ||
return true; | ||
} | ||
@@ -225,2 +230,13 @@ } | ||
function createChannelSenderFunction(channel, filter) { | ||
return function (message) { | ||
vm.connection.subject.next({ | ||
action: vm.connection.options.notifyAction, | ||
channel: channel, | ||
filter: filter, | ||
data: message | ||
}); | ||
} | ||
} | ||
return { | ||
@@ -240,3 +256,4 @@ subscribe: subscribe, | ||
filterJoinAction: 'ADD', | ||
filterLeaveAction: 'REMOVE' | ||
filterLeaveAction: 'REMOVE', | ||
notifyAction: 'NOTIFY' | ||
}; | ||
@@ -255,3 +272,4 @@ | ||
filterJoinAction: userOptions.filterJoinAction || defaultOptions.filterJoinAction, | ||
filterLeaveAction: userOptions.filterLeaveAction || defaultOptions.filterLeaveAction | ||
filterLeaveAction: userOptions.filterLeaveAction || defaultOptions.filterLeaveAction, | ||
notifyAction: userOptions.notifyAction || defaultOptions.notifyAction | ||
} | ||
@@ -258,0 +276,0 @@ } |
{ | ||
"name": "rxjs-ws-channels-filters", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "RxJS websockets implementation with channels and filters", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -52,4 +52,11 @@ # rxjs-ws-channels-filters | ||
} | ||
return true; | ||
} | ||
} | ||
}, | ||
// default options for actions | ||
channelJoinAction: 'JOIN', | ||
channelLeaveAction: 'LEAVE', | ||
filterJoinAction: 'ADD', | ||
filterLeaveAction: 'REMOVE', | ||
notifyAction: 'NOTIFY' | ||
}; | ||
@@ -75,2 +82,4 @@ | ||
}); | ||
filterSub.send('this is a message, from filter'); //send messages to server on this channel and filter | ||
@@ -87,5 +96,4 @@ setTimeout(function () { | ||
### TODO | ||
* add ability to send user messages to server on a channel and filter | ||
* make a separate repo with a server side node implementation | ||
* make better documentation | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15642
310
97