public class OkHttpWebSocketClient extends okhttp3.WebSocketListener implements HalfDuplexClient, FullDuplexClient
| 限定符和类型 | 字段和说明 |
|---|---|
protected AtomicBoolean |
isFirstMessage |
protected io.reactivex.FlowableEmitter<DashScopeResult> |
responseEmitter |
| 构造器和说明 |
|---|
OkHttpWebSocketClient(okhttp3.OkHttpClient client,
boolean passTaskStarted) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
cancel() |
boolean |
close(int code,
String reason) |
io.reactivex.Flowable<DashScopeResult> |
duplex(FullDuplexRequest req) |
void |
duplex(FullDuplexRequest req,
ResultCallback<DashScopeResult> callback) |
void |
onClosed(okhttp3.WebSocket webSocket,
int code,
String reason) |
void |
onClosing(okhttp3.WebSocket webSocket,
int code,
String reason) |
void |
onFailure(okhttp3.WebSocket webSocket,
Throwable t,
okhttp3.Response response) |
void |
onMessage(okhttp3.WebSocket webSocket,
okio.ByteString bytes) |
void |
onMessage(okhttp3.WebSocket webSocket,
String text) |
void |
onOpen(okhttp3.WebSocket webSocket,
okhttp3.Response response) |
DashScopeResult |
send(HalfDuplexRequest req)
Blocking send http request and get the response body.
|
void |
send(HalfDuplexRequest req,
ResultCallback<DashScopeResult> callback) |
protected void |
sendBinaryWithRetry(String apiKey,
boolean isSecurityCheck,
okio.ByteString message,
String workspace,
Map<String,String> customHeaders,
String baseWebSocketUrl) |
protected CompletableFuture<Void> |
sendStreamRequest(FullDuplexRequest req) |
protected void |
sendTextWithRetry(String apiKey,
boolean isSecurityCheck,
String message,
String workspace,
Map<String,String> customHeaders,
String baseWebSocketUrl) |
DashScopeResult |
streamIn(FullDuplexRequest req) |
void |
streamIn(FullDuplexRequest req,
ResultCallback<DashScopeResult> callback) |
io.reactivex.Flowable<DashScopeResult> |
streamOut(HalfDuplexRequest req) |
void |
streamOut(HalfDuplexRequest req,
ResultCallback<DashScopeResult> callback) |
protected AtomicBoolean isFirstMessage
protected io.reactivex.FlowableEmitter<DashScopeResult> responseEmitter
public OkHttpWebSocketClient(okhttp3.OkHttpClient client,
boolean passTaskStarted)
public boolean close(int code,
String reason)
close 在接口中 FullDuplexClientclose 在接口中 HalfDuplexClientpublic void cancel()
cancel 在接口中 FullDuplexClientpublic void onClosed(okhttp3.WebSocket webSocket,
int code,
String reason)
onClosed 在类中 okhttp3.WebSocketListenerpublic void onClosing(okhttp3.WebSocket webSocket,
int code,
String reason)
onClosing 在类中 okhttp3.WebSocketListenerpublic void onFailure(okhttp3.WebSocket webSocket,
Throwable t,
okhttp3.Response response)
onFailure 在类中 okhttp3.WebSocketListenerpublic void onMessage(okhttp3.WebSocket webSocket,
String text)
onMessage 在类中 okhttp3.WebSocketListenerpublic void onMessage(okhttp3.WebSocket webSocket,
okio.ByteString bytes)
onMessage 在类中 okhttp3.WebSocketListenerpublic void onOpen(okhttp3.WebSocket webSocket,
okhttp3.Response response)
onOpen 在类中 okhttp3.WebSocketListenerprotected void sendTextWithRetry(String apiKey, boolean isSecurityCheck, String message, String workspace, Map<String,String> customHeaders, String baseWebSocketUrl)
protected void sendBinaryWithRetry(String apiKey, boolean isSecurityCheck, okio.ByteString message, String workspace, Map<String,String> customHeaders, String baseWebSocketUrl)
public DashScopeResult send(HalfDuplexRequest req)
HalfDuplexClientsend 在接口中 HalfDuplexClientreq - the user input data and parameters.public void send(HalfDuplexRequest req, ResultCallback<DashScopeResult> callback)
send 在接口中 HalfDuplexClientpublic io.reactivex.Flowable<DashScopeResult> streamOut(HalfDuplexRequest req)
streamOut 在接口中 HalfDuplexClientpublic void streamOut(HalfDuplexRequest req, ResultCallback<DashScopeResult> callback)
streamOut 在接口中 HalfDuplexClientprotected CompletableFuture<Void> sendStreamRequest(FullDuplexRequest req)
public DashScopeResult streamIn(FullDuplexRequest req)
streamIn 在接口中 FullDuplexClientpublic void streamIn(FullDuplexRequest req, ResultCallback<DashScopeResult> callback) throws NoApiKeyException, ApiException
streamIn 在接口中 FullDuplexClientNoApiKeyExceptionApiExceptionpublic io.reactivex.Flowable<DashScopeResult> duplex(FullDuplexRequest req) throws NoApiKeyException, ApiException
duplex 在接口中 FullDuplexClientNoApiKeyExceptionApiExceptionpublic void duplex(FullDuplexRequest req, ResultCallback<DashScopeResult> callback) throws NoApiKeyException, ApiException
duplex 在接口中 FullDuplexClientNoApiKeyExceptionApiExceptionCopyright © 2025. All rights reserved.