Re: Where to Delegate for StreamDelegate?


On Nov 28, 2017, at 7:26 AM, Brandon Peters <> wrote:

• Apply the StreamDelegate protocol to the chat view controller class.
This is too low level a task for the view controller to be handling.

• Create a "network manager" singleton class, and apply the StreamDelegate to this class.
That’s more reasonable, though there’s no reason this has to be a singleton, and “Connection” might be a better class name. Calling something a “Manager” is often an indication that you haven’t fully thought through what it’s for :)

(At a higher level: unless you’re doing this explicitly for education, it’s kind of painful to implement a network protocol at the raw-byte-stream level. I would recommend at least building on top of a WebSocket library, which will save you a lot of problems dealing with message framing, flow control, SSL, proxy support, and so on.)


Join to automatically receive all group messages.