Skip to content

Instantly share code, notes, and snippets.

@wemakeweb
Created March 31, 2011 21:11
Show Gist options
  • Save wemakeweb/897265 to your computer and use it in GitHub Desktop.
Save wemakeweb/897265 to your computer and use it in GitHub Desktop.
function encode(messages){
var ret = '', message,
messages = io.util.isArray(messages) ? messages : [messages];
for (var i = 0, l = messages.length; i < l; i++){
message = messages[i] === null || messages[i] === undefined ? '' : stringify(messages[i]);
ret += frame + message.length + frame + message;
}
return ret;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment