-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Description
Hello,
I'm using socket.io 1.3.7:
When I'm doing :
io.to(channel).emit('subject', { toJSON: '{"myString": "As Json"}' });
I receive this :
TypeError: obj.toJSON is not a function
at _hasBinary (/home/jderuere/Repository/pup/pup-activity-logging/node_modules/socket.io/node_modules/has-binary-data/index.js:43:19)
at _hasBinary (/home/jderuere/Repository/pup/pup-activity-logging/node_modules/socket.io/node_modules/has-binary-data/index.js:47:40)
at _hasBinary (/home/jderuere/Repository/pup/pup-activity-logging/node_modules/socket.io/node_modules/has-binary-data/index.js:47:40)
at _hasBinary (/home/jderuere/Repository/pup/pup-activity-logging/node_modules/socket.io/node_modules/has-binary-data/index.js:47:40)
at _hasBinary (/home/jderuere/Repository/pup/pup-activity-logging/node_modules/socket.io/node_modules/has-binary-data/index.js:37:15)
at _hasBinary (/home/jderuere/Repository/pup/pup-activity-logging/node_modules/socket.io/node_modules/has-binary-data/index.js:47:40)
at _hasBinary (/home/jderuere/Repository/pup/pup-activity-logging/node_modules/socket.io/node_modules/has-binary-data/index.js:37:15)
at _hasBinary (/home/jderuere/Repository/pup/pup-activity-logging/node_modules/socket.io/node_modules/has-binary-data/index.js:47:40)
at _hasBinary (/home/jderuere/Repository/pup/pup-activity-logging/node_modules/socket.io/node_modules/has-binary-data/index.js:47:40)
at _hasBinary (/home/jderuere/Repository/pup/pup-activity-logging/node_modules/socket.io/node_modules/has-binary-data/index.js:37:15)
at hasBinary (/home/jderuere/Repository/pup/pup-activity-logging/node_modules/socket.io/node_modules/has-binary-data/index.js:56:10)
at Namespace.emit (/my-project/node_modules/socket.io/lib/namespace.js:210:9)
I think it should be :
if (obj.toJSON && typeof obj.toJSON == 'function')
Thanks for all the works.