Closed globin closed 9 years ago
+1 for filtering via a function.
In my view filtering by a string/regex should be deprecated as its too app-specific. It only works if you message uses a data
property, which has to be a string. For example our app uses a structure like: { messageType: 'foo', data: { rat: 1, } }
. Rather than waiting for users to ask for more configuration options to support alternate message structure and needing to document them, a function is a simpler solution and works for everyone.
NGWebSocket.prototype._onMessageHandler() now take a
filter
property on the callback instead ofpattern
. This can additionally to being a string to match on exactly or a RegExp pattern be a function which will run the callback if the function evaluates totrue
.