BlueSocketConnectionListener

public class BlueSocketConnectionListener: ParserConnecting

The Interface between the StreamingParser class and IBM’s BlueSocket wrapper around socket(2). You hopefully should be able to replace this with any network library/engine.

  • initializer

    • Parameters:
      • socket: Socket object from BlueSocket library wrapping a socket(2)
      • parser: Manager of the CHTTPParser library

    Declaration

    Swift

    public init(socket: Socket, parser: StreamingParser, readQueue: DispatchQueue, writeQueue: DispatchQueue)
  • Check if socket is still open. Used to decide whether it should be closed/pruned after timeout

    Declaration

    Swift

    public var isOpen: Bool
  • Called by the parser to let us know that it’s done with this socket

    Declaration

    Swift

    public func closeWriter()
  • Called by the parser to let us know that a response has started being created

    Declaration

    Swift

    public func responseBeginning()
  • Called by the parser to let us know that a response is complete, and we can close after timeout

    Declaration

    Swift

    public func responseComplete()
  • Starts reading from the socket and feeding that data to the parser

    Declaration

    Swift

    public func process()
  • Called by the parser to give us data to send back out of the socket

    Parameter

    Parameter bytes: Data object to be queued to be written to the socket

    Declaration

    Swift

    public func queueSocketWrite(_ bytes: Data)
  • Write data to a socket. Should be called in an async block on the socketWriterQueue

    Parameter

    Parameter data: data to be written

    Declaration

    Swift

    public func write(_ data:Data)