Closed TomFreudenberg closed 9 years ago
I added a Basic Usage section. Tell me what you think about it :)
Hi Julien,
that's all pretty nice. In case that I like the KISS principle as said, I would shorten the basic usage just to:
// Attach a client handler for custom message type
Streamy.on('hello', function(d) {
console.log(d.data); // Will print 'world!'
});
// Push a message to all connected listeners from any client or server
Streamy.broadcast('hello', { data: 'world!' });
Thereafter you could continue with your Core paragraph as you did already.
Cheers Tom
Hmmm, I still want to show that you can send a message to the server only. I think that's the core of the project so I guess I should let it that way.
np, it is your decision ;-)
For me the core function is to broadcast from server to client but that depends on how you use this library and what is your own project about.
Hi,
I would suggest to move the description of CORE functions (your beginning chapter) near the end of the README just as the chapter behind Direct Communication.
Therfor you start with a simple example of Broadcast which works driectly for new users. I made the fault to start with
on server part.
This won't raise an error but also won't reach any client cause, .emit on server needs a socket.
To avoid first time usage beginning with "frustration" I would prefer to start with the easy working broadcasting example.
My 10 cents Tom