This method is used within the module and needs to ensure that it is not null.
If there is an external call involved, the isInit method needs to be called first to check the status.
Add SSE interceptor to listen sse dispatch. usually receive sse from cache pool, sse will dispatch to SSEInterceptor.intercept
if need to receive from server sse immediately, please refer SSEInterceptor.isPeek parameter.
isOnly represent interceptor don't support add multiple times by same SSEInterceptor.name.
Initialization method, which must be called during use
config Configuration information used to config such as version number, logFileName, debug mode etc.
dio Associated with dio, currently SSEProcessor acts as an interceptor in dio component
Open agent stream, support set outside stream for dispatch sse. (for example sse from db)
key is an identity marker that is associated with the agentStream.
agentStream takes on the proxy responsibility and is responsible for the logic of external conversion of SSE streams
goCachePool is put in cache pool then deliver sse
autoRemove remove agentStream in _agentStreams when stream end
supportPeekDispatch Directly distribute to the interceptors that support peek mode, it only take effect when goCachePool is true.
Very rare usage scenario, for example i want to replace some scatter sse to one gathered sse.
This function support the story : https://pm.ifitu.co/issues/19143fromHit is function to remove when match the rule, according return result, true will be delete.
toEvent will be insert to sse cache head of SSECacheDeliverer
The application usually uses the sseProcessorFactory object create a SSEProcessor to receive sse events, because the early theater only runs one, usually only one SSEProcessor,
so the structure is designed according to the singleton, currently for multiple theater situations,
still want to extend the singleton use mode, to avoid major changes.
Warning : This value couldn't set too small (maybe 0 or 1), if set too small will lead to stream end quickly,
when stream end will remove all interceptors that type is AutoClearStrategy.stream or AutoClearStrategy.streamAndFull
these interceptors remove early lead to loss useful data that they want to receive.