Posts

Post not yet marked as solved
6 Replies
 I looked into additionalServerHeaders a bit and this does certainly look like something you can add on the client side of the connection Reading the documentation, additionalServerHeaders is supposed to contain “additional HTTP headers sent by the server during the WebSocket handshake.”; I don't think they can be set client side. (But I'm totally new to the framework so I trust your words much more than my assumptions). To give you more context: If, client side, I set some headers: let wsOptions = NWProtocolWebSocket.Options() wsOptions.setAdditionalHeaders([("custom-client-header", "test-client”)]) I’m able to retrieve them server side (the test server is implemented with Network.framework locally), like so: let wsOptions = NWProtocolWebSocket.Options() wsOptions.setClientRequestHandler(serverQueue) { (_, headers) -> NWProtocolWebSocket.Response in print(headers) /* [(name: "custom-client-header", value: "test-client"), (name: "Host", value: "localhost")] ✅ */ 		let additionalServerHeaders = [("custom-server-header", “test-server”)] /* set some custom headers */ 		return.init(status: .accept, subprotocol: nil, additionalHeaders: additionalServerHeaders) } At this point, since I’ve set new headers server side during the handshake, I thought I could access them client side somehow: My first try (client side) was: connection = NWConnection(…) connection.stateUpdateHandler = { [weak self] state in guard let self = self else { return } /* the cast to NWProtocolWebSocket.Metadata always fails */ if let metadata = self.connection.metadata(definition: NWProtocolWebSocket.definition) as? NWProtocolWebSocket.Metadata { 				print(metadata.additionalServerHeaders) 		} } My second one was: connection.receiveMessage { [weak self] (data, context, isComplete, error) in if let context = context, let metadata = context.protocolMetadata.first as? NWProtocolWebSocket.Metadata { print(metadata.additionalServerHeaders) /* nil */ 	} } In short: I didn't find a way to proper access the NWProtocolWebSocket.Metadata additionalServerHeaders. Again, thank you for spending your time looking into this.
Post not yet marked as solved
6 Replies
Thanks for the suggestions; I will certanly look into them. I am not aware of any way to do this during the handshake.  Ok, I thought it could be possible using the additionalServerHeaders - https://developer.apple.com/documentation/network/nwprotocolwebsocket/metadata/3200532-additionalserverheaders defined in the NWProtocolWebSocket.Metadata. Please follow up with your Feedback ID. FB8782882
Post not yet marked as solved
3 Replies
Did you prepare an example by any chance? I've played with NSBatchInsertRequest init(entity:managedObjectHandler:) and it seems working fine.
Post not yet marked as solved
6 Replies
I would like to look for additional custom HTTP headers set by the server in the handshake response. (not the Connection: Upgrade header, if you're referring to that). Thanks
Post not yet marked as solved
39 Replies
Post not yet marked as solved
3 Replies
I've contacted Apple and it seems that for VoIP pushes, this field must be: voip (but it's not documented)
Post not yet marked as solved
12 Replies
Did you receive any updates from your feedback request?