Hi,
I have been successful at writing Swift code using a NWListener to listen to WebSocket connections on a specific port, but I do not seem to be able to get the path from the URL for creating different types of connections.
For instance, differentiating between ws://127.0.0.1:80/updates and ws://127.0.0.1:80/changes.
I'd like to be able to get the "updates" or "changes" part when I receive the new connection notification.
Having more sample code around WebSockets and how the upgrade process works that would also be great.
Thank you !
Daniel Tapie
Post
Replies
Boosts
Views
Activity
So I'd like to listen on port 80 for instance and depending on the request, upgrade the connection to WebSocket or leave it as HTTP.
I could have two different servers on two different ports, but that is not what I want as they need to share the same port.
Thank you !
Daniel Tapie
I am trying to have multiple applications listen to the same port but from different local IP addresses but it looks like it doesn't work.
Here is my code:
localEndPoint = nw_endpoint_create_host(ip1, port1234)
nw_parameters_set_local_endpoint(params, localEndPoint);
...
nw_listener_create(params)
...
So application 1 will use ip1 and application 2 a different local address (ip2) to listen from.
When I do that, the second app launched always fails to start the listener with an "address already in use" error.
I thought it was possible, but I am obviously wrong...
Any insight anyone ?
Thanks !
Daniel
Hi,
I have been searching all over for a way to do this on macOS: playing different stereo files on different pairs of audio outputs of the same hardware device.
I am currently using AVAudioEngine with two AVAudioPlayerNodes and I can mix them and change the mapping of the entire mix through the use of AudioUnitSetProperty on the engine output, but I cannot have multiple AVAudioPlayerNodes play on different outputs.
Obviously, being on macOS I cannot use AVAudioSession...
Thank you if anyone has any idea on how to achieve this !
Apparently, the call to performDefaultImplementation of an AppleScript is called on the main runloop with the defaultModes only, so it is not called while a menu (or contextual menu) is open.
This is very unfortunate as it means the execution of these scripts is delayed until after the menu is closed.
Looking for a way to change this behaviour but I have no clue how...
Thanks !
Daniel
It looks like that, with Sequoia, it is not possible to open an NSURLSession or any other TCP connection to a machine on the local network if the application is not in the "Applications" folder. That is pretty inconvenient when debugging or running via Xcode since the build folder is not within the Applications folder.
And, yes, the NSLocalNetworkUsageDescription key and description strings are in the Info.plist file (and it asks for permission).
How can we expect to debug applications like that ?
Is anybody else experiencing this ?