Right now every single chat prompt as a completely isolated event. When you type a message and press enter, the app dynamically allocates a random, short-lived port on your computer (like 59032) to talk to Ollama (port 11434). It initiates a full TCP three-way handshake to open a channel, streams the AI's response, and then immediately kills the connection.
For your very next message, it has to throw away that socket, allocate a brand new port (like 59038), and perform the entire handshake ceremony all over again. This constant cycle of opening, tearing down, and cleaning up network sockets is known as connection churning.
A persistent HTTP connection (HTTP keep-alive) could easily solve this by reserving a port and keeping the connection open between message turns in a chat session.
Right now every single chat prompt as a completely isolated event. When you type a message and press enter, the app dynamically allocates a random, short-lived port on your computer (like 59032) to talk to Ollama (port 11434). It initiates a full TCP three-way handshake to open a channel, streams the AI's response, and then immediately kills the connection.
For your very next message, it has to throw away that socket, allocate a brand new port (like 59038), and perform the entire handshake ceremony all over again. This constant cycle of opening, tearing down, and cleaning up network sockets is known as connection churning.
A persistent HTTP connection (HTTP keep-alive) could easily solve this by reserving a port and keeping the connection open between message turns in a chat session.