Multi-Network-Protocols support application using swift-nio

Hi all,

I started a swift SIP Client application based on swift-nio. So I'm supposed to implement many Network Protocol handlers (SIP,RTP,etc) that will coexist inside one app.

What is unclear for me is:

  • Does I'm supposed to have as many EventLoopGroup as I have network protocol to support ? Is it a one - one relation. Is there any attention to take by having many EventLoopGroup inside one application.

  • Does many DatagramBootstrap (UDP) and ClientBootstrap (TCP) can coexist inside one application.

Thanks in advance for any advices.


There are very few situations where you might want to have more than one eventloop group. So no, it is not a one - one relation. An example is miniircd which runs both IRC and HTTP (and WebSocket), clients and servers, within a single eventloop group.

The one thing I can imagine is that for a SIP client, you may want to use one specific thread (i.e. own EventLoop[Group]) just for the data intensive transport protocol and another one for the OOB protocols. But solely as an optimisation (so that OOB processing isn't affected by a flood of data requests).

Note that single EventLoop's (aka thread) also conform to EventLoopGroup, so you can assign them to a config which takes a 'group'.