use of okhttp3.WebSocket in project Cobinhood.Java by jd-alexander.
the class CobinhoodSocket method doConnect.
private void doConnect() {
if (webSocket != null) {
if (eventStream.hasObservers()) {
eventStream.accept(new Open());
}
return;
}
OkHttpClient okHttpClient = new OkHttpClient.Builder().build();
okHttpClient.newWebSocket(request, webSocketListener());
}
use of okhttp3.WebSocket in project runelite by runelite.
the class WSClient method connect.
void connect() {
Request request = new Request.Builder().url(RuneLiteAPI.getWsEndpoint()).build();
webSocket = client.newWebSocket(request, this);
Handshake handshake = new Handshake();
handshake.setSession(session.getUuid());
send(handshake);
}
use of okhttp3.WebSocket in project drift-sdk-android by Driftt.
the class Socket method connect.
public void connect() throws IOException {
LoggerHelper.logMessage(TAG, "connect");
disconnect();
// No support for ws:// or ws:// in okhttp. See https://github.com/square/okhttp/issues/1652
final String httpUrl = this.endpointUri.replaceFirst("^ws:", "http:").replaceFirst("^wss:", "https:");
final Request request = new Request.Builder().url(httpUrl).build();
webSocket = httpClient.newWebSocket(request, wsListener);
}
use of okhttp3.WebSocket in project okhttp by square.
the class RealWebSocketTest method smallMessagesNotCompressed.
@Test
public void smallMessagesNotCompressed() throws IOException {
Headers headers = Headers.of("Sec-WebSocket-Extensions", "permessage-deflate");
client.initWebSocket(random, 0, headers);
server.initWebSocket(random, 0, headers);
String message = TestUtil.repeat('a', (int) DEFAULT_MINIMUM_DEFLATE_SIZE - 1);
server.webSocket.send(message);
// Not compressed.
assertThat(client.clientSourceBufferSize()).isGreaterThan(message.length());
assertThat(client.processNextFrame()).isTrue();
client.listener.assertTextMessage(message);
}
use of okhttp3.WebSocket in project okhttp by square.
the class WebSocketRecorder method onClosed.
@Override
public void onClosed(WebSocket webSocket, int code, String reason) {
Platform.get().log("[WS " + name + "] onClosed " + code, Platform.INFO, null);
WebSocketListener delegate = this.delegate;
if (delegate != null) {
this.delegate = null;
delegate.onClosed(webSocket, code, reason);
} else {
events.add(new Closed(code, reason));
}
}
Aggregations