Skip to content

feat(lib-transformer): specify event type inside of chunk of streamed…#52

Open
zjakin wants to merge 1 commit intomtharrison:masterfrom
zjakin:master
Open

feat(lib-transformer): specify event type inside of chunk of streamed…#52
zjakin wants to merge 1 commit intomtharrison:masterfrom
zjakin:master

Conversation

@zjakin
Copy link

@zjakin zjakin commented Jan 19, 2017

Allows sending a stream of events of different types through a single channel.
How to use:

On server side

    stream.write({ event: 'SPECIFIC_EVENT', 'some data' }); 
    stream.write({ event: 'OTHER_EVENT', 'some data' }); 
    reply(stream);

On client side

eventSource.addEventListener('SPECIFIC_EVENT', (e) => {
                const results = JSON.parse(e.data);
                this.hosts = results;
            }, false);
eventSource.addEventListener('OTHER_EVENT', (e) => {
                const results = JSON.parse(e.data);
                this.hosts = results;
            }, false);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant