Class OkHttpWebSocketClient
java.lang.Object
okhttp3.WebSocketListener
com.alibaba.dashscope.legacy_2x.protocol.okhttp.OkHttpWebSocketClient
- All Implemented Interfaces:
FullDuplexClient,HalfDuplexClient
- Direct Known Subclasses:
OkHttpWebSocketClientForAudio
@Deprecated
public class OkHttpWebSocketClient
extends okhttp3.WebSocketListener
implements HalfDuplexClient, FullDuplexClient
Deprecated.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AtomicBooleanDeprecated.protected AtomicBooleanDeprecated.protected io.reactivex.FlowableEmitter<DashScopeResult>Deprecated.protected io.reactivex.disposables.DisposableDeprecated. -
Constructor Summary
ConstructorsConstructorDescriptionOkHttpWebSocketClient(okhttp3.OkHttpClient client, boolean passTaskStarted) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()Deprecated.close websocket connection see.booleanDeprecated.io.reactivex.Flowable<DashScopeResult>duplex(FullDuplexRequest req) Deprecated.voidduplex(FullDuplexRequest req, ResultCallback<DashScopeResult> callback) Deprecated.protected voidemitResponseError(Throwable error) Deprecated.Publishes a terminal error on the response stream.protected voidDeprecated.Core streaming request logic.protected StringDeprecated.protected static intintSetting(String systemProperty, String envName, int defaultValue) Deprecated.Reads an int setting from the system property first, then from the environment variable, and falls back to the default value when both are absent or malformed.protected voidonBeforeSendStartMessage(com.google.gson.JsonObject startMessage) Deprecated.Hook method called before sending the start message.voidDeprecated.voidDeprecated.voidDeprecated.voidDeprecated.voidonMessage(okhttp3.WebSocket webSocket, okio.ByteString bytes) Deprecated.voidonOpen(okhttp3.WebSocket webSocket, okhttp3.Response response) Deprecated.send(HalfDuplexRequest req) Deprecated.Blocking send http request and get the response body.voidsend(HalfDuplexRequest req, ResultCallback<DashScopeResult> callback) Deprecated.protected voidsendBinaryWithRetry(String apiKey, boolean isSecurityCheck, okio.ByteString message, String workspace, Map<String, String> customHeaders, String baseWebSocketUrl, String module) Deprecated.protected CompletableFuture<Void>Deprecated.protected voidsendTextWithRetry(String apiKey, boolean isSecurityCheck, String message, String workspace, Map<String, String> customHeaders, String baseWebSocketUrl, String module) Deprecated.Deprecated.voidstreamIn(FullDuplexRequest req, ResultCallback<DashScopeResult> callback) Deprecated.io.reactivex.Flowable<DashScopeResult>Deprecated.voidstreamOut(HalfDuplexRequest req, ResultCallback<DashScopeResult> callback) Deprecated.
-
Field Details
-
isClosed
Deprecated. -
isFirstMessage
Deprecated. -
responseEmitter
Deprecated. -
streamingDataDisposable
protected volatile io.reactivex.disposables.Disposable streamingDataDisposableDeprecated.
-
-
Constructor Details
-
OkHttpWebSocketClient
public OkHttpWebSocketClient(okhttp3.OkHttpClient client, boolean passTaskStarted) Deprecated.
-
-
Method Details
-
getRequestIdOrUnknown
Deprecated. -
close
Deprecated.- Specified by:
closein interfaceFullDuplexClient- Specified by:
closein interfaceHalfDuplexClient
-
cancel
public void cancel()Deprecated.close websocket connection see. https://square.github.io/okhttp/3.x/okhttp/okhttp3/WebSocket.html- Specified by:
cancelin interfaceFullDuplexClient
-
intSetting
Deprecated.Reads an int setting from the system property first, then from the environment variable, and falls back to the default value when both are absent or malformed. -
onClosed
Deprecated.- Overrides:
onClosedin classokhttp3.WebSocketListener
-
onClosing
Deprecated.- Overrides:
onClosingin classokhttp3.WebSocketListener
-
onFailure
Deprecated.- Overrides:
onFailurein classokhttp3.WebSocketListener
-
onMessage
Deprecated.- Overrides:
onMessagein classokhttp3.WebSocketListener
-
onMessage
public void onMessage(okhttp3.WebSocket webSocket, okio.ByteString bytes) Deprecated.- Overrides:
onMessagein classokhttp3.WebSocketListener
-
onOpen
public void onOpen(okhttp3.WebSocket webSocket, okhttp3.Response response) Deprecated.- Overrides:
onOpenin classokhttp3.WebSocketListener
-
sendTextWithRetry
protected void sendTextWithRetry(String apiKey, boolean isSecurityCheck, String message, String workspace, Map<String, String> customHeaders, String baseWebSocketUrl, String module) Deprecated. -
sendBinaryWithRetry
protected void sendBinaryWithRetry(String apiKey, boolean isSecurityCheck, okio.ByteString message, String workspace, Map<String, String> customHeaders, String baseWebSocketUrl, String module) Deprecated. -
send
Deprecated.Description copied from interface:HalfDuplexClientBlocking send http request and get the response body.- Specified by:
sendin interfaceHalfDuplexClient- Parameters:
req- the user input data and parameters.- Returns:
- The the `DashScopeResult`.
-
send
Deprecated.- Specified by:
sendin interfaceHalfDuplexClient
-
streamOut
Deprecated.- Specified by:
streamOutin interfaceHalfDuplexClient
-
streamOut
Deprecated.- Specified by:
streamOutin interfaceHalfDuplexClient
-
onBeforeSendStartMessage
protected void onBeforeSendStartMessage(com.google.gson.JsonObject startMessage) Deprecated.Hook method called before sending the start message. Subclasses may override to add additional logging or pre-processing. -
emitResponseError
Deprecated.Publishes a terminal error on the response stream. When no subscriber is attached yet, the error is parked and replayed as soon as one subscribes: a failure raised early, a handshake refused by the server for instance, can otherwise be reported before the caller of duplex() had the chance to subscribe, which would leave that caller waiting forever. -
executeStreamRequest
Deprecated.Core streaming request logic. Extracted to allow subclasses to use different executors. -
sendStreamRequest
Deprecated. -
streamIn
Deprecated.- Specified by:
streamInin interfaceFullDuplexClient
-
streamIn
public void streamIn(FullDuplexRequest req, ResultCallback<DashScopeResult> callback) throws NoApiKeyException, ApiException Deprecated.- Specified by:
streamInin interfaceFullDuplexClient- Throws:
NoApiKeyExceptionApiException
-
duplex
public io.reactivex.Flowable<DashScopeResult> duplex(FullDuplexRequest req) throws NoApiKeyException, ApiException Deprecated.- Specified by:
duplexin interfaceFullDuplexClient- Throws:
NoApiKeyExceptionApiException
-
duplex
public void duplex(FullDuplexRequest req, ResultCallback<DashScopeResult> callback) throws NoApiKeyException, ApiException Deprecated.- Specified by:
duplexin interfaceFullDuplexClient- Throws:
NoApiKeyExceptionApiException
-