Skip to content

Commit

Permalink
Add docs to explain inbound/outbound (#142)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukasa authored and normanmaurer committed Mar 19, 2018
1 parent b6dbaa5 commit a3fad28
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Sources/NIO/ChannelHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ public protocol ChannelHandler: class {

/// Untyped `ChannelHandler` which handles outbound I/O events or intercept an outbound I/O operation.
///
/// We _strongly_ advice against implementing this protocol directly. Please implement `ChannelOutboundHandler`.
/// Despite the fact that `write` is one of the methods on this `protocol`, you should avoid assuming that "outbound" events are to do with
/// writing to channel sources. Instead, "outbound" events are events that are passed *to* the channel source (e.g. a socket): that is, things you tell
/// the channel source to do. That includes `write` ("write this data to the channel source"), but it also includes `read` ("please begin attempting to read from
/// the channel source") and `bind` ("please bind the following address"), which have nothing to do with sending data.
///
/// We _strongly_ advise against implementing this protocol directly. Please implement `ChannelOutboundHandler`.
public protocol _ChannelOutboundHandler: ChannelHandler {

/// Called to request that the `Channel` register itself for I/O events with its `EventLoop`.
Expand Down Expand Up @@ -124,7 +129,12 @@ public protocol _ChannelOutboundHandler: ChannelHandler {

/// Untyped `ChannelHandler` which handles inbound I/O events.
///
/// We _strongly_ advice against implementing this protocol directly. Please implement `ChannelInboundHandler`.
/// Despite the fact that `channelRead` is one of the methods on this `protocol`, you should avoid assuming that "inbound" events are to do with
/// reading from channel sources. Instead, "inbound" events are events that originate *from* the channel source (e.g. the socket): that is, events that the
/// channel source tells you about. This includes things like `channelRead` ("there is some data to read"), but it also includes things like
/// `channelWritabilityChanged` ("this source is no longer marked writable").
///
/// We _strongly_ advise against implementing this protocol directly. Please implement `ChannelInboundHandler`.
public protocol _ChannelInboundHandler: ChannelHandler {

/// Called when the `Channel` has successfully registered with its `EventLoop` to handle I/O.
Expand Down

0 comments on commit a3fad28

Please # to comment.