001/* 002 * Copyright 2022-2026 Revetware LLC. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package com.soklet; 018 019/** 020 * Reasons why a streaming HTTP response, Server-Sent Event connection, or MCP SSE stream may terminate. 021 * 022 * @author <a href="https://www.revetkn.com">Mark Allen</a> 023 */ 024public enum StreamTerminationReason { 025 /** 026 * The stream completed normally. 027 */ 028 COMPLETED, 029 /** 030 * The client disconnected before the stream completed. 031 */ 032 CLIENT_DISCONNECTED, 033 /** 034 * The server stopped before the stream completed. 035 */ 036 SERVER_STOPPING, 037 /** 038 * The request protocol cannot support the stream. 039 */ 040 PROTOCOL_UNSUPPORTED, 041 /** 042 * The stream exceeded its configured total response timeout. 043 */ 044 RESPONSE_TIMEOUT, 045 /** 046 * The stream exceeded its configured producer idle timeout. 047 */ 048 RESPONSE_IDLE_TIMEOUT, 049 /** 050 * Producer code intentionally aborted the stream. 051 */ 052 APPLICATION_CANCELED, 053 /** 054 * The stream was closed due to backpressure. 055 */ 056 BACKPRESSURE, 057 /** 058 * The stream ended because its owning session was terminated. 059 */ 060 SESSION_TERMINATED, 061 /** 062 * A write to the stream failed. 063 */ 064 WRITE_FAILED, 065 /** 066 * The stream producer failed. 067 */ 068 PRODUCER_FAILED, 069 /** 070 * An unexpected internal error occurred. 071 */ 072 INTERNAL_ERROR, 073 /** 074 * The simulator refused to materialize more streaming response bytes. 075 */ 076 SIMULATOR_LIMIT_EXCEEDED, 077 /** 078 * The stream ended for an unspecified reason. 079 */ 080 UNKNOWN 081}