What is the documentation referring to by "Streaming Protocols"?

The documentation for Protocols and Transports has a section for Streaming Protocols

I’m trying to make sense of two statements:

1. in Streaming Protocols

Event methods, such as loop.create_server(), … accept factories that return streaming protocols.

2. in the documentation of asyncio.loop.create_server

  • protocol_factory must be a callable returning a protocol implementation.

The only implementations of Protocol I’m aware of are those defined in cpython/Lib/asyncio/protocols.py at 3.12 · python/cpython · GitHub

Can someone please point me to where Streaming Protocols (if any) are defined?

Oh duh, I’ve just read Protocol more carefully and:

class Protocol(BaseProtocol):
    """Interface for stream protocol.

    ....

So I guess, every Protocol is a Streaming Protocol?

I think so.

Note “protocol” here has little to do with typing.Protocol, in case anyone was confused by that.

2 Likes

asyncio.protocols.Protocol works with SOCK_STREAM (TCP) sockets, making it a streaming protocol.
Also, there are protocols for datagram sockets (UDP) and subprocesses.