Class: SocketIo::Packet::AckPacket
- Inherits:
-
SocketIo::Packet
- Object
- SocketIo::Packet
- SocketIo::Packet::AckPacket
- Defined in:
- lib/socket.io/packet/ack_packet.rb
Constant Summary
Constants inherited from SocketIo::Packet
Instance Attribute Summary collapse
-
#ack_id ⇒ Object
Returns the value of attribute ack_id.
-
#args ⇒ Object
Returns the value of attribute args.
Attributes inherited from SocketIo::Packet
Instance Method Summary collapse
Methods inherited from SocketIo::Packet
#ackdata?, #initialize, #json, parse, parse_json
Constructor Details
This class inherits a constructor from SocketIo::Packet
Instance Attribute Details
#ack_id ⇒ Object
Returns the value of attribute ack_id.
6 7 8 |
# File 'lib/socket.io/packet/ack_packet.rb', line 6 def ack_id @ack_id end |
#args ⇒ Object
Returns the value of attribute args.
6 7 8 |
# File 'lib/socket.io/packet/ack_packet.rb', line 6 def args @args end |
Instance Method Details
#parse_pieces(pieces) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/socket.io/packet/ack_packet.rb', line 8 def parse_pieces(pieces) if sub_pieces = data =~ /^([0-9]+)(\+)?(.*)/ self.ack_id = sub_pieces[1]; self.args = []; if sub_pieces[3] self.args = Packet.parse_json(sub_pieces[3]) || []; end end end |
#to_s ⇒ Object
21 22 23 24 25 |
# File 'lib/socket.io/packet/ack_packet.rb', line 21 def to_s payload = ack_id.to_s payload += '+' + args.to_json if args super payload end |
#type_id ⇒ Object
19 |
# File 'lib/socket.io/packet/ack_packet.rb', line 19 def type_id; 6; end |