Permalink
Browse files

Added error and heartbeat decoding

  • Loading branch information...
3rd-Eden committed Oct 15, 2011
1 parent 54c22ae commit 00557f663acd7a8762925dbf0eab10a0b9fa713a
Showing with 24 additions and 0 deletions.
  1. +8 −0 benchmarks/decode.bench.js
  2. +16 −0 benchmarks/encode.bench.js
@@ -25,6 +25,14 @@ suite.add('event+data', function () {
parser.decodePacket('5:::{"name":"edwald","args":[{"a": "b"},2,"3"]}');
});
+suite.add('heartbeat', function () {
+ parser.decodePacket('2:::');
+});
+
+suite.add('error', function () {
+ parser.decodePacket('7:::2+0');
+});
+
var payload = parser.encodePayload([
parser.encodePacket({ type: 'message', data: '5', endpoint: '' })
, parser.encodePacket({ type: 'message', data: '53d', endpoint: '' })
View
@@ -45,6 +45,22 @@ suite.add('event+data', function () {
});
});
+suite.add('heartbeat', function () {
+ parser.encodePacket({
+ type: 'heartbeat'
+ , endpoint: ''
+ })
+});
+
+suite.add('error', function () {
+ parser.encodePacket({
+ type: 'error'
+ , reason: 'unauthorized'
+ , advice: 'reconnect'
+ , endpoint: ''
+ })
+})
+
suite.add('payload', function () {
parser.encodePayload([
parser.encodePacket({ type: 'message', data: '5', endpoint: '' })

0 comments on commit 00557f6

Please sign in to comment.