rxjs-ws-channels-filters
RxJS implementation of websockets with channels and filters
Work in progress
var options = url: 'localhost:3000/api' { // 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 { ; }; } { // transform the response from server return message; } { // transform the request sent to server if messagefilters && messagefilterslength var i = messagefilterslength - 1; for ; i > -1; i-- messagefiltersitype = messagechannel; return message; } { // 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; } { // 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 sourcep !== targetp return false; return true; } // default options for actions channelJoinAction: 'JOIN' channelLeaveAction: 'LEAVE' filterJoinAction: 'ADD' filterLeaveAction: 'REMOVE' notifyAction: 'NOTIFY' ; var socket = options; console; socketchannels; socketchannels; socketchannels; var filterSub = socketchannels; filterSub; //send messages to server on this channel and filter ;
TODO
- make a separate repo with a server side node implementation
- make better documentation
- make demo