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
0
votes
1 answer

Swift NIO EventLoopFuture chain not completing

I have a very simple service built on a Vapor app. The service consumes data from another family of services. Obviously this is just the sort of application the map methods were made for. All the callbacks in the chain execute, but the last…
Jerry
  • 3,391
  • 1
  • 19
  • 28
0
votes
1 answer

Does SwiftNIO have a mechanism similar to GCD barriers?

Can GCD and SwiftNIO co-exist? Pardon me ignorance. This has me confused. Reasoning: Having too many threads is detrimental to performance; GCD creates and manages its own threads; SwiftNIO creates and manages its own threads; If you use many…
user14873944
0
votes
1 answer

SwiftNIO: Sent package partially received

I have developed a client and a server using swift nio, I have no problems sending package of all size between 12 and 1000bytes since server sends a pack of 528bytes and when client got it, it is 512bytes. I'm trying to figure out why it happens.…
0
votes
2 answers

Write a CircularBuffer (swift-nio) to a file in Swift using OutputStream?

I am trying to use a CircularBuffer from SwiftNIO to store data and once the buffer is almost full dump the contents to a file using an OutputStream. Unfortunately, the OutputStream.write() method takes UnsafePointer as an argument, while the…
jiko
  • 146
  • 1
  • 9
0
votes
1 answer

Can I use SwiftNIO client websocket with different server websocket?

I am new to WebSocket, choosing between https://github.com/daltoniam/Starscream and SwiftNIO, With SwiftNIO couldn't find clear guidelines, can I Use just SwiftNIO client WebSocket in iOS. and the WebSocket server will be implemented using different…
Chandan Shetty SP
  • 5,087
  • 6
  • 42
  • 63
0
votes
1 answer

TLS CA certificate SSL Pinning using SWIFT-NIO-SSL

I have been trying to use SWIFT-NIO-SSL, to connect to server using the CA certificate and Server certificate. After numeral attempts, and trying out different approaches, I could not get a solution. Is there any tutorial or any help in connecting…
BlackPearl12
  • 306
  • 5
  • 20
0
votes
1 answer

Digest Authentication using async-http-client

I am trying to implement digest authentication using async-http-client on top of swiftNIO. Therefore I use a class which uses the HTTPClientResponseDelegate protocol. In this class in the func didReceiveHead(task: HTTPClient.Task, _ head:…
Arnold Schmid
  • 163
  • 12
0
votes
1 answer

How to use async-http-client

I am trying to execute the example of async-http-client doku. But unfortunately the code in the closure is not executed. Why? import AsyncHTTPClient let httpClient = HTTPClient(eventLoopGroupProvider: .createNew) httpClient.get(url:…
Arnold Schmid
  • 163
  • 12
0
votes
1 answer

SwiftNIO: connect is not working if the code is in a class

I just started with SwiftNIO and I used this code for the first try: let group = MultiThreadedEventLoopGroup(numberOfThreads: 1) let bootstrap = ClientBootstrap(group: group) // Enable SO_REUSEADDR. …
Lupurus
  • 3,618
  • 2
  • 29
  • 59
0
votes
1 answer

How to use worker queues in SwiftNIO?

I have a Swift NIO HTTP2 server which handles request within the context's event loop. But I want to process the request in another thread, GCD aync thread pool and get the result back and send it. public func channelRead(context:…
John Doe
  • 2,225
  • 6
  • 16
  • 44
0
votes
1 answer

Why is Swift NIO example uses HTTP/2 to HTTP/1 protocol conversion?

What's the purpose the HTTP2ToHTTP1ServerCodec. Why is it required to convert the HTTP/2 to HTTP/1 protocol? channel.configureHTTP2Pipeline(mode: .server) { (streamChannel, streamID) -> EventLoopFuture in // For every HTTP/2 stream that…
John Doe
  • 2,225
  • 6
  • 16
  • 44
0
votes
1 answer

Add multiple channel pipeline handlers in SwiftNIO similarly as Java Netty

I am exploring how to add multiple handlers in channel pipelines in SwiftNIO. In Java Netty, I have the following code: @Component public class NettyClientFilter extends ChannelInitializer { @Autowired private…
Rui Huang
  • 382
  • 1
  • 5
  • 18
1 2 3
4