mediasoup-demo - Connection to websocket server URL invalid

Hi all,

Generated localhost certs, using postman for the Express layer and tested it with success on finding the https server but throwing 404 room not found for example when trying ’/rooms/:roomId which makes sense since I didn’t connect to the WebSocket and created a roomId and peerId.

Using a WebSocket client (I am open to other tools to test the connection to WebSocket server) I can’t seem to connect in any way.

I changed the config.js to the below settings (LISTEN_IP to my local IP - 192.168.2.15).

// mediasoup WebRtcTransport options for WebRTC endpoints (mediasoup-client,
		// libmediasoupclient).
		// See https://mediasoup.org/documentation/v3/mediasoup/api/#WebRtcTransportOptions
		webRtcTransportOptions :
		{
			listenIps :
			[
				{
					ip          : process.env.MEDIASOUP_LISTEN_IP || '192.168.2.15',
					announcedIp : process.env.MEDIASOUP_ANNOUNCED_IP
				}
			],
			initialAvailableOutgoingBitrate : 1000000,
			minimumAvailableOutgoingBitrate : 600000,
			maxSctpMessageSize              : 262144,
			// Additional options that are not part of WebRtcTransportOptions.
			maxIncomingBitrate              : 1500000
		},
		// mediasoup PlainTransport options for legacy RTP endpoints (FFmpeg,
		// GStreamer).
		// See https://mediasoup.org/documentation/v3/mediasoup/api/#PlainTransportOptions
		plainTransportOptions :
		{
			listenIp :
			{
				ip          : process.env.MEDIASOUP_LISTEN_IP || '192.168.2.15',
				announcedIp : process.env.MEDIASOUP_ANNOUNCED_IP
			},
			maxSctpMessageSize : 262144
		}

https settings

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`
		}
	},

I tried the URLs wss://192.168.2.15:4443, wss://192.168.2.15:443 and wss://192.168.2.15 but getting an invalid connection

Kind of stuck here…any help to test the connection?

OK I actually made it to connect from my iOS application and receiving the below in console output of Xcode. It doesn’t seem like a problem honestly, it is logged as warning

viabilityChanged: true
error: Optional(Starscream.HTTPUpgradeError.notAnUpgrade(403))

In server the WARN message is below.

protoo-server:WARN:WebSocketServer _onRequest() | invalid/missing Sec-WebSocket-Protocol +4m

I found in the protoo-server source code that is needed to set as protoo after setting the request.setValue("protoo", forHTTPHeaderField: "Sec-WebSocket-Protocol") it worked