skaarj1989/mWebSockets

Simplify examples how to use callbacks

Closed this issue · 1 comments

Hi,
thanks a lot for this awesome lib.
I would like to suggest to simplify the usage of callbacks in the examples to be more readable (for novices like me :)).
I have written an example here in which the callback function construction is separated in 3 parts, and one liner initialization in setup.
I thought you (or someone else) maybe find it useful.
If you do not think that makes sense, just close this issue.

Hi @stevstrong

  • I wanted the source code of the examples to be as much cross-platform as possible so that anyone could just upload a sketch to a board of choice and it would just work.
  • API of this library is inspired on node.js ws - hence the use of lambda. (in my opinion it also increases the readability of the code)

I think that I could create wiki page dedicated to usage of this library (with code snippets).