docs/Protocols/SocketParsable.html
public protocol SocketParsable : AnyObject
Defines that a type will be able to parse socket.io-protocol messages.
Methods
`
parseBinaryData(_:)
`
Called when the engine has received some binary data that should be attached to a packet.
Packets binary data should be sent directly after the packet that expects it, so there’s confusion over where the data should go. Data should be received in the order it is sent, so that the correct data is put into the correct placeholder.
Swift
func parseBinaryData(_ data: Data) -> SocketPacket?
| data |
The data that should be attached to a packet.
|
`
parseSocketMessage(_:)
`
Called when the engine has received a string that should be parsed into a socket.io packet.
Swift
func parseSocketMessage(_ message: String) -> SocketPacket?
| message |
The string that needs parsing.
|
A completed socket packet if there is no more data left to collect.
Available where Self: SocketManagerSpec & SocketDataBufferable
`
parseSocketMessage(_:)
` Default implementation
Called when the engine has received a string that should be parsed into a socket.io packet.
Swift
func parseSocketMessage(_ message: String) -> SocketPacket?
| message |
The string that needs parsing.
|
A completed socket packet or nil if the packet is invalid.
`
parseBinaryData(_:)
` Default implementation
Called when the engine has received some binary data that should be attached to a packet.
Packets binary data should be sent directly after the packet that expects it, so there’s confusion over where the data should go. Data should be received in the order it is sent, so that the correct data is put into the correct placeholder.
Swift
func parseBinaryData(_ data: Data) -> SocketPacket?
| data |
The data that should be attached to a packet.
|
A completed socket packet if there is no more data left to collect.