aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--system/include/emscripten/emscripten.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/system/include/emscripten/emscripten.h b/system/include/emscripten/emscripten.h
index 994a75a7..d669938d 100644
--- a/system/include/emscripten/emscripten.h
+++ b/system/include/emscripten/emscripten.h
@@ -176,11 +176,13 @@ extern void emscripten_cancel_main_loop(void);
*
* The userData pointer allows arbitrary data specified during Event
* registration to be passed to the callback, this is particularly
- * useful for passing "this" pointers around in Object Orienter code.
+ * useful for passing "this" pointers around in Object Oriented code.
*
* In addition to being able to register network callbacks from C
* it is also possible for native JavaScript code to directly use the
- * underlying mechanism used to implement the callback registration:
+ * underlying mechanism used to implement the callback registration.
+ * For example, the following are the simple logging callbacks that
+ * are registered by default when SOCKET_DEBUG is enabled
* Module['websocket']['on']('error', function(error) {console.log('Socket error ' + error);});
* Module['websocket']['on']('open', function(fd) {console.log('Socket open fd = ' + fd);});
* Module['websocket']['on']('listen', function(fd) {console.log('Socket listen fd = ' + fd);});
@@ -188,6 +190,11 @@ extern void emscripten_cancel_main_loop(void);
* Module['websocket']['on']('message', function(fd) {console.log('Socket message fd = ' + fd);});
* Module['websocket']['on']('close', function(fd) {console.log('Socket close fd = ' + fd);});
*
+ * Most of the JavaScript callback functions above get passed the
+ * file descriptor of the socket that triggered the callback, the
+ * on error callback however gets passed an *array* that contains
+ * the file descriptor, the error code and an error message.
+ *
* Note that the underlying JavaScript implementation doesn't pass
* userData, this is actually mostly of use to C/C++ code and the
* emscripten_set_socket_*_callback calls actually create a closure