Questions tagged [swift-nio]

Use the swift-nio tag for questions related to the Apple Swift NIO (non-blocking I/O) framework.

Swift NIO is a Swift framework released by Apple in March 2018. Think of it as a Netty port to the Swift programming language.

It can be used to write high performance protocol servers. For example HTTP endpoints, or any other kind of Internet protocol server, or client for that matter.

What Apple says:

SwiftNIO is a cross-platform asynchronous event-driven network application framework for rapid development of maintainable high performance protocol servers & clients.

It's like Netty, but written for Swift.

57 questions
1
vote
1 answer

How to branch out of a 'Future' sequence in a single Vapor route?

How can computation flow branch out of a sequence of multiple Future actions, in a single Vapor route, to return a simple String Response which indicates which stage was exited? Future methods catch(_:), catchMap(on:_:), and catchFlatMap(_:) can…
marc-medley
  • 8,931
  • 5
  • 60
  • 66
0
votes
0 answers

What about my Swift-NIO-SSL handshake is failing?

I am trying to figure out what about my TLS handshake is failing. I am not exactly sure what this error code means. Can someone provide more context here? 2000-00-00T00:00:00-0000 error [[GRPC-LOGG]] :…
wizeOnes
  • 119
  • 16
0
votes
1 answer

How to build Swift gRPC with OpenSSL (or SSL provider other than BoringSSL)

Currently working on a project that uses Swift-gRPC; which uses BoringSSL. I would like to know if it is possible to use a custom SSL Provider, such as OpenSSL. I found this post that allows you to specify an SSL provider for the gRPC C++ library. I…
wizeOnes
  • 119
  • 16
0
votes
0 answers

Swift build for linux/amd64 fails with strange error

I have a swift app with the following dependencies: .package(url: "https://github.com/apple/swift-nio.git", .upToNextMajor(from: "2.41.1")), .package(url: "https://github.com/apple/swift-crypto.git", .upToNextMajor(from: "2.1.0")) Building…
tweeterist
  • 25
  • 6
0
votes
1 answer

SwiftNIO: TCP Server not sending data back

I have written my own handler for SwiftNIO but I cannot get it to send anything. class MyHandler: ChannelInboundHandler { public typealias InboundIn = ByteBuffer public typealias OutboundOut = ByteBuffer public func…
iphaaw
  • 6,764
  • 11
  • 58
  • 83
0
votes
1 answer

Property does not persist in array?

My goal is to persist a swift-nio Scheduled instance in a struct named Receiver in an array to potentially use later. It creates the Receiver, stores it in the array and adds the Scheduled instance, but the Receiver instance in the array does not…
cj-
  • 167
  • 1
  • 12
0
votes
1 answer

SwiftNIO: How "expensive" is transformation in each ChannelHandler?

Checking this tutorial: https://rderik.com/blog/understanding-swiftnio-by-building-a-text-modifying-server/ One thing I do not understand that the main point using NIO directly is to increase speed of a backend service. But, when we has this…
János
  • 32,867
  • 38
  • 193
  • 353
0
votes
1 answer

Appropriate background mode for Swift NIO client

I've created an iOS app, that connects to an embedded device using swift-nio-ssh. This app has no UI to control the device, as that is supposed to be done with a Watch app, using WatchConnectivity. As it stands, I have to keep the iOS app in the…
szagun
  • 123
  • 8
0
votes
1 answer

How to Connect to MySQL database using Swift-Nio

I used node js to connect mysql server and it is working good. I used the API developed in node js and used in the local macOS app. The problem is querying the data from mysql database on workbench is fast but in node js API it is very delay. So,…
iDeveloper
  • 41
  • 7
0
votes
1 answer

How to transfer data between SwiftNIO TCP-server and Python based TCP-client?

I have a TCP server written in SwiftNIO, based on this documentation. I want my client to be written in python from which I can send multiple JSON strings & can receive similar/different multiple JSON string(s) as a response periodically for a few…
spt025
  • 2,134
  • 2
  • 20
  • 26
0
votes
1 answer

Is is possible to open SwiftNIO based server socket within XCTest test app?

I have an XCTest which works with UI components. I tried to open a server socket within the xctext function using SwiftNIO. I took the echo server example from here. and I simplified, removed the args with hardcoded values for the sake of a dirty…
Tibor Kiss
  • 143
  • 1
  • 1
  • 6
0
votes
1 answer

Best practice for sending to connected clients

I'm trying to design a SwiftNIO server where multiple clients (like 2 or 3) can connect to the server, and when connected, they can all receive information from the server. To do this, I create a ServerHandler class which is shared & added to each…
user17718216
0
votes
1 answer

Handle Swift-nio server-side TCP connection event and send context data to client

I'm working on a COPS (rfc 2748) protocol handler. I need to be able to send a message from the server to the client immediately after a TCP connection is established. I'm not finding any API that describes this capability. Any pointers would be…
0
votes
1 answer

Swift-NIO based proxy reconfigures pipeline on every incoming request

I'm using Swift-NIO to create a Http/2 proxy with TLS, for iOS/tvOS. My proxy startup: var tlsConfiguration = ... tlsConfiguration.applicationProtocols = NIOHTTP2SupportedALPNProtocols let bootstrap = NIOTSListenerBootstrap(group:…
WilliamVH
  • 11
  • 3
0
votes
1 answer

Remote connection using SwiftNIO SSH

I am working on a solution that would Read/Write Server files from remote gateway system to the local storage of iOS device using SwiftNIO SSH. This way I would be able to execute shell commands. I checked in Swift's website but couldn't find…
Avneet Singh
  • 55
  • 1
  • 11