File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -266,13 +266,6 @@ RecognizeStream.prototype.initialize = function() {
266
266
}
267
267
268
268
socket . onmessage = function ( frame ) {
269
- /**
270
- * Emit any messages received over the wire, mainly used for debugging.
271
- *
272
- * @event RecognizeStream#message
273
- * @param {Object } message - frame object with a data attribute that's either a string or a Buffer/TypedArray
274
- */
275
- self . emit ( 'message' , frame ) ;
276
269
277
270
if ( typeof frame . data !== 'string' ) {
278
271
return emitError ( 'Unexpected binary data received from server' , frame ) ;
@@ -285,6 +278,15 @@ RecognizeStream.prototype.initialize = function() {
285
278
return emitError ( 'Invalid JSON received from service:' , frame , jsonEx ) ;
286
279
}
287
280
281
+ /**
282
+ * Emit any messages received over the wire, mainly used for debugging.
283
+ *
284
+ * @event RecognizeStream#message
285
+ * @param {Object } message - frame object with a data attribute that's either a string or a Buffer/TypedArray
286
+ * @param {Object } [data] - parsed JSON object (if possible);
287
+ */
288
+ self . emit ( 'message' , frame , data ) ;
289
+
288
290
if ( data . error ) {
289
291
emitError ( data . error , frame ) ;
290
292
} else if ( data . state === 'listening' ) {
You can’t perform that action at this time.
0 commit comments