2222
2323import Foundation
2424
25+ /// Defines that a type will be able to parse socket.io-protocol messages.
2526protocol SocketParsable {
27+ /// Called when the engine has received some binary data that should be attached to a packet.
28+ ///
29+ /// Packets binary data should be sent directly after the packet that expects it, so there's confusion over
30+ /// where the data should go. Data should be received in the order it is sent, so that the correct data is put
31+ /// into the correct placeholder.
32+ ///
33+ /// - parameter data: The data that should be attached to a packet.
2634 func parseBinaryData( _ data: Data )
35+
36+ /// Called when the engine has received a string that should be parsed into a socket.io packet.
37+ ///
38+ /// - parameter message: The string that needs parsing.
2739 func parseSocketMessage( _ message: String )
2840}
2941
@@ -133,7 +145,9 @@ extension SocketParsable where Self: SocketIOClientSpec {
133145 }
134146 }
135147
136- // Parses messages recieved
148+ /// Called when the engine has received a string that should be parsed into a socket.io packet.
149+ ///
150+ /// - parameter message: The string that needs parsing.
137151 func parseSocketMessage( _ message: String ) {
138152 guard !message. isEmpty else { return }
139153
@@ -150,6 +164,13 @@ extension SocketParsable where Self: SocketIOClientSpec {
150164 }
151165 }
152166
167+ /// Called when the engine has received some binary data that should be attached to a packet.
168+ ///
169+ /// Packets binary data should be sent directly after the packet that expects it, so there's confusion over
170+ /// where the data should go. Data should be received in the order it is sent, so that the correct data is put
171+ /// into the correct placeholder.
172+ ///
173+ /// - parameter data: The data that should be attached to a packet.
153174 func parseBinaryData( _ data: Data ) {
154175 guard !waitingPackets. isEmpty else {
155176 DefaultSocketLogger . Logger. error ( " Got data when not remaking packet " , type: " SocketParser " )
0 commit comments