SocketParsable

public protocol SocketParsable : AnyObject

Defines that a type will be able to parse socket.io-protocol messages.

  • 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.

    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.

    Declaration

    Swift

    func parseBinaryData(_ data: Data) -> SocketPacket?

    Parameters

    data

    The data that should be attached to a packet.

  • parseSocketMessage(_:) Default implementation

    Called when the engine has received a string that should be parsed into a socket.io packet.

    Default Implementation

    Called when the engine has received a string that should be parsed into a socket.io packet.

    Declaration

    Swift

    func parseSocketMessage(_ message: String) -> SocketPacket?

    Parameters

    message

    The string that needs parsing.

    Return Value

    A completed socket packet if there is no more data left to collect.