Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

var debug = require('debug')('socket.io-parser');
var CircularJSON = require('circular-json');
var Emitter = require('component-emitter');
var hasBin = require('has-binary2');
var binary = require('./binary');
Expand Down Expand Up @@ -170,7 +171,7 @@ function encodeAsString(obj) {

// json data
if (null != obj.data) {
str += JSON.stringify(obj.data);
str += CircularJSON.stringify(obj.data);
}

debug('encoded %j as %s', obj, str);
Expand Down Expand Up @@ -327,7 +328,7 @@ function decodeString(str) {

function tryParse(p, str) {
try {
p.data = JSON.parse(str);
p.data = CircularJSON.parse(str);
} catch(e){
return error();
}
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
"is-buffer.js"
],
"dependencies": {
"debug": "~2.6.4",
"circular-json": "^0.4.0",
"component-emitter": "1.2.1",
"debug": "~2.6.4",
"has-binary2": "~1.0.2",
"isarray": "2.0.1"
},
Expand Down