SendTransportListener delegate methods never invoked (libMediasoupClient via iOS wrapper)

I have the below code to create a MediasoupDevice client send transport.

let id = jsonResponse["id"].stringValue
    let dtlsParameters: JSON = jsonResponse["dtlsParameters"]
    let iceParameters: JSON = jsonResponse["iceParameters"]
    let iceCandidatesArray: JSON = jsonResponse["iceCandidates"]
    let sctpParameters: JSON = jsonResponse["sctpParameters"]
    
    self.sendTransport = mediasoupDevice!.createSendTransport(self, id: id, iceParameters: iceParameters.description, iceCandidates: iceCandidatesArray.description, dtlsParameters: dtlsParameters.description, sctpParameters: sctpParameters.description, options: nil, appData: nil)
    
    print("Local Transport\nID: \(self.sendTransport!.getId()!)\nConn State: \(self.sendTransport!.getConnectionState()!)\nIsClosed: \(self.sendTransport!.isClosed())")

And the function implementations.

extension MediasoupRoomManager : SendTransportListener {
  
  func onProduce(_ transport: Transport!, kind: String!, rtpParameters: String!, appData: String!, callback: ((String?) -> Void)!) {
    print("SendTransport::onProduce" + kind + "rtpParameters = " + rtpParameters)
    onLocalTransportProduce(transport: transport, kind: kind, rtpParameters: rtpParameters, appData: appData, callback: callback)
  }
  
  func onConnect(_ transport: Transport!, dtlsParameters: String!) {
    print("SendTransport::onConnect dtlsParameters = " + dtlsParameters)
    onLocalTransportConnect(transport: transport, dtlsParameters: dtlsParameters)
  }
  
  func onConnectionStateChange(_ transport: Transport!, connectionState: String!) {
    print("SendTransport::onConnectionStateChange connectionState = " + connectionState)
  }
  
}

None of the delegate methods are invoked, there are no errors in my console for send or receive transport creation.
I set the mediasoup log to the below.

// Set mediasoup log
    Logger.setLogLevel(LogLevel.TRACE)
    Logger.setDefaultHandler()

And the console output, I can’t seem to find an error although I don’t understand where is the last output coming from.

websocket is connected: ["Sec-WebSocket-Protocol": "protoo", "Upgrade": "websocket", "Origin": "wss://192.168.2.2:4443", "Connection": "Upgrade", "Sec-WebSocket-Accept": "zfL/KQvv9fXc50GReMMRRYaE+08="]
[DEBUG] Device::Load() | got native RTP capabilities:
{
    "codecs": [
        {
            "channels": 1,
            "clockRate": 8000,
            "kind": "audio",
            "mimeType": "audio/PCMU",
            "parameters": {},
            "preferredPayloadType": 0,
            "rtcpFeedback": []
        },
        {
            "channels": 1,
            "clockRate": 8000,
            "kind": "audio",
            "mimeType": "audio/PCMA",
            "parameters": {},
            "preferredPayloadType": 8,
            "rtcpFeedback": []
        },
        {
            "channels": 1,
            "clockRate": 8000,
            "kind": "audio",
            "mimeType": "audio/G722",
            "parameters": {},
            "preferredPayloadType": 9,
            "rtcpFeedback": []
        },
        {
            "channels": 1,
            "clockRate": 8000,
            "kind": "audio",
            "mimeType": "audio/CN",
            "parameters": {},
            "preferredPayloadType": 13,
            "rtcpFeedback": []
        },
        {
            "clockRate": 90000,
            "kind": "video",
            "mimeType": "video/VP8",
            "parameters": {},
            "preferredPayloadType": 96,
            "rtcpFeedback": [
                {
                    "type": "goog-remb"
                },
                {
                    "type": "transport-cc"
                },
                {
                    "parameter": "fir",
                    "type": "ccm"
                },
                {
                    "type": "nack"
                },
                {
                    "parameter": "pli",
                    "type": "nack"
                }
            ]
        },
        {
            "clockRate": 90000,
            "kind": "video",
            "mimeType": "video/rtx",
            "parameters": {
                "apt": 96
            },
            "preferredPayloadType": 97,
            "rtcpFeedback": []
        },
        {
            "clockRate": 90000,
            "kind": "video",
            "mimeType": "video/VP9",
            "parameters": {
                "profile-id": "0"
            },
            "preferredPayloadType": 98,
            "rtcpFeedback": [
                {
                    "type": "goog-remb"
                },
                {
                    "type": "transport-cc"
                },
                {
                    "parameter": "fir",
                    "type": "ccm"
                },
                {
                    "type": "nack"
                },
                {
                    "parameter": "pli",
                    "type": "nack"
                }
            ]
        },
        {
            "clockRate": 90000,
            "kind": "video",
            "mimeType": "video/rtx",
            "parameters": {
                "apt": 98
            },
            "preferredPayloadType": 99,
            "rtcpFeedback": []
        },
        {
            "clockRate": 90000,
            "kind": "video",
            "mimeType": "video/AV1X",
            "parameters": {},
            "preferredPayloadType": 100,
            "rtcpFeedback": [
                {
                    "type": "goog-remb"
                },
                {
                    "type": "transport-cc"
                },
                {
                    "parameter": "fir",
                    "type": "ccm"
                },
                {
                    "type": "nack"
                },
                {
                    "parameter": "pli",
                    "type": "nack"
                }
            ]
        },
        {
            "clockRate": 90000,
            "kind": "video",
            "mimeType": "video/rtx",
            "parameters": {
                "apt": 100
            },
            "preferredPayloadType": 101,
            "rtcpFeedback": []
        },
        {
            "channels": 1,
            "clockRate": 8000,
            "kind": "audio",
            "mimeType": "audio/ILBC",
            "parameters": {},
            "preferredPayloadType": 102,
            "rtcpFeedback": []
        },
        {
            "channels": 1,
            "clockRate": 16000,
            "kind": "audio",
            "mimeType": "audio/ISAC",
            "parameters": {},
            "preferredPayloadType": 103,
            "rtcpFeedback": []
        },
        {
            "channels": 1,
            "clockRate": 32000,
            "kind": "audio",
            "mimeType": "audio/ISAC",
            "parameters": {},
            "preferredPayloadType": 104,
            "rtcpFeedback": []
        },
        {
            "channels": 1,
            "clockRate": 16000,
            "kind": "audio",
            "mimeType": "audio/CN",
            "parameters": {},
            "preferredPayloadType": 105,
            "rtcpFeedback": []
        },
        {
            "channels": 1,
            "clockRate": 32000,
            "kind": "audio",
            "mimeType": "audio/CN",
            "parameters": {},
            "preferredPayloadType": 106,
            "rtcpFeedback": []
        },
        {
            "channels": 1,
            "clockRate": 48000,
            "kind": "audio",
            "mimeType": "audio/telephone-event",
            "parameters": {},
            "preferredPayloadType": 110,
            "rtcpFeedback": []
        },
        {
            "channels": 2,
            "clockRate": 48000,
            "kind": "audio",
            "mimeType": "audio/opus",
            "parameters": {
                "minptime": 10,
                "useinbandfec": 1
            },
            "preferredPayloadType": 111,
            "rtcpFeedback": [
                {
                    "type": "transport-cc"
                }
            ]
        },
        {
            "channels": 1,
            "clockRate": 32000,
            "kind": "audio",
            "mimeType": "audio/telephone-event",
            "parameters": {},
            "preferredPayloadType": 112,
            "rtcpFeedback": []
        },
        {
            "channels": 1,
            "clockRate": 16000,
            "kind": "audio",
            "mimeType": "audio/telephone-event",
            "parameters": {},
            "preferredPayloadType": 113,
            "rtcpFeedback": []
        },
        {
            "clockRate": 90000,
            "kind": "video",
            "mimeType": "video/rtx",
            "parameters": {
                "apt": 127
            },
            "preferredPayloadType": 124,
            "rtcpFeedback": []
        },
        {
            "clockRate": 90000,
            "kind": "video",
            "mimeType": "video/ulpfec",
            "parameters": {},
            "preferredPayloadType": 125,
            "rtcpFeedback": []
        },
        {
            "channels": 1,
            "clockRate": 8000,
            "kind": "audio",
            "mimeType": "audio/telephone-event",
            "parameters": {},
            "preferredPayloadType": 126,
            "rtcpFeedback": []
        },
        {
            "clockRate": 90000,
            "kind": "video",
            "mimeType": "video/red",
            "parameters": {},
            "preferredPayloadType": 127,
            "rtcpFeedback": []
        }
    ],
    "fecMechanisms": [],
    "headerExtensions": [
        {
            "kind": "audio",
            "preferredId": 1,
            "uri": "urn:ietf:params:rtp-hdrext:ssrc-audio-level"
        },
        {
            "kind": "audio",
            "preferredId": 2,
            "uri": "http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time"
        },
        {
            "kind": "audio",
            "preferredId": 3,
            "uri": "http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01"
        },
        {
            "kind": "audio",
            "preferredId": 4,
            "uri": "urn:ietf:params:rtp-hdrext:sdes:mid"
        },
        {
            "kind": "audio",
            "preferredId": 5,
            "uri": "urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id"
        },
        {
            "kind": "audio",
            "preferredId": 6,
            "uri": "urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id"
        },
        {
            "kind": "video",
            "preferredId": 14,
            "uri": "urn:ietf:params:rtp-hdrext:toffset"
        },
        {
            "kind": "video",
            "preferredId": 2,
            "uri": "http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time"
        },
        {
            "kind": "video",
            "preferredId": 13,
            "uri": "urn:3gpp:video-orientation"
        },
        {
            "kind": "video",
            "preferredId": 3,
            "uri": "http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01"
        },
        {
            "kind": "video",
            "preferredId": 12,
            "uri": "http://www.webrtc.org/experiments/rtp-hdrext/playout-delay"
        },
        {
            "kind": "video",
            "preferredId": 11,
            "uri": "http://www.webrtc.org/experiments/rtp-hdrext/video-content-type"
        },
        {
            "kind": "video",
            "preferredId": 7,
            "uri": "http://www.webrtc.org/experiments/rtp-hdrext/video-timing"
        },
        {
            "kind": "video",
            "preferredId": 8,
            "uri": "http://tools.ietf.org/html/draft-ietf-avtext-framemarking-07"
        },
        {
            "kind": "video",
            "preferredId": 9,
            "uri": "http://www.webrtc.org/experiments/rtp-hdrext/color-space"
        },
        {
            "kind": "video",
            "preferredId": 4,
            "uri": "urn:ietf:params:rtp-hdrext:sdes:mid"
        },
        {
            "kind": "video",
            "preferredId": 5,
            "uri": "urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id"
        },
        {
            "kind": "video",
            "preferredId": 6,
            "uri": "urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id"
        }
    ]
}
[DEBUG] Device::Load() | got extended RTP capabilities:
{
    "codecs": [
        {
            "channels": 2,
            "clockRate": 48000,
            "kind": "audio",
            "localParameters": {
                "minptime": 10,
                "useinbandfec": 1
            },
            "localPayloadType": 111,
            "localRtxPayloadType": null,
            "mimeType": "audio/opus",
            "remoteParameters": {},
            "remotePayloadType": 100,
            "remoteRtxPayloadType": null,
            "rtcpFeedback": [
                {
                    "parameter": "",
                    "type": "transport-cc"
                }
            ]
        },
        {
            "clockRate": 90000,
            "kind": "video",
            "localParameters": {},
            "localPayloadType": 96,
            "localRtxPayloadType": 97,
            "mimeType": "video/VP8",
            "remoteParameters": {
                "x-google-start-bitrate": 1000
            },
            "remotePayloadType": 101,
            "remoteRtxPayloadType": 102,
            "rtcpFeedback": [
                {
                    "parameter": "",
                    "type": "goog-remb"
                },
                {
                    "parameter": "",
                    "type": "transport-cc"
                },
                {
                    "parameter": "fir",
                    "type": "ccm"
                },
                {
                    "parameter": "",
                    "type": "nack"
                },
                {
                    "parameter": "pli",
                    "type": "nack"
                }
            ]
        }
    ],
    "headerExtensions": [
        {
            "direction": "sendrecv",
            "encrypt": false,
            "kind": "audio",
            "recvId": 1,
            "sendId": 4,
            "uri": "urn:ietf:params:rtp-hdrext:sdes:mid"
        },
        {
            "direction": "sendrecv",
            "encrypt": false,
            "kind": "video",
            "recvId": 1,
            "sendId": 4,
            "uri": "urn:ietf:params:rtp-hdrext:sdes:mid"
        },
        {
            "direction": "sendonly",
            "encrypt": false,
            "kind": "video",
            "recvId": 2,
            "sendId": 5,
            "uri": "urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id"
        },
        {
            "direction": "sendonly",
            "encrypt": false,
            "kind": "video",
            "recvId": 3,
            "sendId": 6,
            "uri": "urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id"
        },
        {
            "direction": "sendrecv",
            "encrypt": false,
            "kind": "audio",
            "recvId": 4,
            "sendId": 2,
            "uri": "http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time"
        },
        {
            "direction": "sendrecv",
            "encrypt": false,
            "kind": "video",
            "recvId": 4,
            "sendId": 2,
            "uri": "http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time"
        },
        {
            "direction": "sendonly",
            "encrypt": false,
            "kind": "audio",
            "recvId": 5,
            "sendId": 3,
            "uri": "http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01"
        },
        {
            "direction": "sendrecv",
            "encrypt": false,
            "kind": "video",
            "recvId": 5,
            "sendId": 3,
            "uri": "http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01"
        },
        {
            "direction": "sendrecv",
            "encrypt": false,
            "kind": "video",
            "recvId": 6,
            "sendId": 8,
            "uri": "http://tools.ietf.org/html/draft-ietf-avtext-framemarking-07"
        },
        {
            "direction": "sendrecv",
            "encrypt": false,
            "kind": "audio",
            "recvId": 10,
            "sendId": 1,
            "uri": "urn:ietf:params:rtp-hdrext:ssrc-audio-level"
        },
        {
            "direction": "sendrecv",
            "encrypt": false,
            "kind": "video",
            "recvId": 11,
            "sendId": 13,
            "uri": "urn:3gpp:video-orientation"
        },
        {
            "direction": "sendrecv",
            "encrypt": false,
            "kind": "video",
            "recvId": 12,
            "sendId": 14,
            "uri": "urn:ietf:params:rtp-hdrext:toffset"
        }
    ]
}
[DEBUG] Device::Load() | got receiving RTP capabilities:
{
    "codecs": [
        {
            "channels": 2,
            "clockRate": 48000,
            "kind": "audio",
            "mimeType": "audio/opus",
            "parameters": {
                "minptime": 10,
                "useinbandfec": 1
            },
            "preferredPayloadType": 100,
            "rtcpFeedback": [
                {
                    "parameter": "",
                    "type": "transport-cc"
                }
            ]
        },
        {
            "clockRate": 90000,
            "kind": "video",
            "mimeType": "video/VP8",
            "parameters": {},
            "preferredPayloadType": 101,
            "rtcpFeedback": [
                {
                    "parameter": "",
                    "type": "goog-remb"
                },
                {
                    "parameter": "",
                    "type": "transport-cc"
                },
                {
                    "parameter": "fir",
                    "type": "ccm"
                },
                {
                    "parameter": "",
                    "type": "nack"
                },
                {
                    "parameter": "pli",
                    "type": "nack"
                }
            ]
        },
        {
            "clockRate": 90000,
            "kind": "video",
            "mimeType": "video/rtx",
            "parameters": {
                "apt": 101
            },
            "preferredPayloadType": 102,
            "rtcpFeedback": []
        }
    ],
    "headerExtensions": [
        {
            "direction": "sendrecv",
            "kind": "audio",
            "preferredEncrypt": false,
            "preferredId": 1,
            "uri": "urn:ietf:params:rtp-hdrext:sdes:mid"
        },
        {
            "direction": "sendrecv",
            "kind": "video",
            "preferredEncrypt": false,
            "preferredId": 1,
            "uri": "urn:ietf:params:rtp-hdrext:sdes:mid"
        },
        {
            "direction": "sendrecv",
            "kind": "audio",
            "preferredEncrypt": false,
            "preferredId": 4,
            "uri": "http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time"
        },
        {
            "direction": "sendrecv",
            "kind": "video",
            "preferredEncrypt": false,
            "preferredId": 4,
            "uri": "http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time"
        },
        {
            "direction": "sendrecv",
            "kind": "video",
            "preferredEncrypt": false,
            "preferredId": 5,
            "uri": "http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01"
        },
        {
            "direction": "sendrecv",
            "kind": "video",
            "preferredEncrypt": false,
            "preferredId": 6,
            "uri": "http://tools.ietf.org/html/draft-ietf-avtext-framemarking-07"
        },
        {
            "direction": "sendrecv",
            "kind": "audio",
            "preferredEncrypt": false,
            "preferredId": 10,
            "uri": "urn:ietf:params:rtp-hdrext:ssrc-audio-level"
        },
        {
            "direction": "sendrecv",
            "kind": "video",
            "preferredEncrypt": false,
            "preferredId": 11,
            "uri": "urn:3gpp:video-orientation"
        },
        {
            "direction": "sendrecv",
            "kind": "video",
            "preferredEncrypt": false,
            "preferredId": 12,
            "uri": "urn:ietf:params:rtp-hdrext:toffset"
        }
    ]
}
[DEBUG] Device::Load() | got receiving SCTP capabilities:
{
    "numStreams": {
        "MIS": 1024,
        "OS": 1024
    }
}
[DEBUG] Device::Load() | succeeded
Local Transport
ID: 15d4696f-c88a-496c-a834-6afe6c6019f8
Conn State: new
IsClosed: false
2020-07-10 13:42:53.017171-0400 Phone[700:106705] [] tcp_input [C2:3] flags=[R] seq=3714223190, ack=0, win=0 state=LAST_ACK rcv_nxt=3714223190, snd_una=3270915267
2020-07-10 13:42:53.017912-0400 Phone[700:106705] [] tcp_input [C2:3] flags=[R] seq=3714223190, ack=0, win=0 state=CLOSED rcv_nxt=3714223190, snd_una=3270915267

My config listenIps:

https:
	{
		listenIp: '0.0.0.0',
		// NOTE: Don't change listenPort (client app assumes 4443).
		listenPort: process.env.PROTOO_LISTEN_PORT || 4443,
		// NOTE: Set your own valid certificate files.
		tls:
		{
			cert: process.env.HTTPS_CERT_FULLCHAIN || `${__dirname}/certs/localhost.cert`,
			key: process.env.HTTPS_CERT_PRIVKEY || `${__dirname}/certs/localhost.key`
		}
	},

webRtcTransportOptions:
		{
			listenIps:
				[
					{
						ip: process.env.MEDIASOUP_LISTEN_IP || '192.168.2.2',
						announcedIp: process.env.MEDIASOUP_ANNOUNCED_IP
					}
				],
			initialAvailableOutgoingBitrate: 1000000,
			minimumAvailableOutgoingBitrate: 600000,
			maxSctpMessageSize: 262144,
			// Additional options that are not part of WebRtcTransportOptions.
			maxIncomingBitrate: 1500000
		},

Due to how SDP O/A works, the onConnect listener won’t be called until you call produce() or consume() in a Transport.

Aha! That makes sense, it seems I need to connect the RTCEAGLVideoView in SwiftUI world and create the RTCVideoTrack to pass to the producer. Thanks for hinting at the next piece of the puzzle!