private int getMessageBufferSize() { return webSocketClient.getPolicy().getMaxBinaryMessageBufferSize(); } }
configurePolicy(context, client.getPolicy()); final String userName = context.getProperty(USER_NAME).evaluateAttributeExpressions().getValue(); final String userPassword = context.getProperty(USER_PASSWORD).evaluateAttributeExpressions().getValue();
/** * Get the maximum size for a text message. * * @return the maximum size of a text message. */ public long getMaxTextMessageSize() { return getPolicy().getMaxTextMessageSize(); }
/** * Return the number of milliseconds for a timeout of an attempted write operation. * * @return number of milliseconds for timeout of an attempted write operation */ public long getAsyncWriteTimeout() { return getPolicy().getAsyncWriteTimeout(); }
/** * Get the maximum size for a binary message. * * @return the maximum size of a binary message. */ public long getMaxBinaryMessageSize() { return getPolicy().getMaxBinaryMessageSize(); }
/** * Get the maximum size for buffering of a binary message. * * @return the maximum size of a binary message buffer. */ public int getMaxBinaryMessageBufferSize() { return getPolicy().getMaxBinaryMessageBufferSize(); }
public void setMaxBinaryMessageBufferSize(int max) { getPolicy().setMaxBinaryMessageBufferSize(max); }
/** * Get the max idle timeout for new connections. * * @return the max idle timeout in milliseconds for new connections. */ public long getMaxIdleTimeout() { return getPolicy().getIdleTimeout(); }
/** * Get the maximum size for buffering of a text message. * * @return the maximum size of a text message buffer. */ public int getMaxTextMessageBufferSize() { return getPolicy().getMaxTextMessageBufferSize(); }
public void setAsyncWriteTimeout(long ms) { getPolicy().setAsyncWriteTimeout(ms); }
public void setMaxTextMessageBufferSize(int max) { getPolicy().setMaxTextMessageBufferSize(max); }
/** * Set the max idle timeout for new connections. * <p> * Existing connections will not have their max idle timeout adjusted. * * @param ms the timeout in milliseconds */ public void setMaxIdleTimeout(long ms) { getPolicy().setIdleTimeout(ms); this.httpClient.setIdleTimeout(ms); }
/** * Opens the initial websocket connection with the gateway. */ void connect() { try { wsClient = new WebSocketClient(new SslContextFactory()); wsClient.getPolicy().setMaxBinaryMessageSize(Integer.MAX_VALUE); wsClient.getPolicy().setMaxTextMessageSize(Integer.MAX_VALUE); wsClient.start(); wsClient.connect(this, new URI("wss://" + endpoint), new ClientUpgradeRequest()); } catch (Exception e) { Discord4J.LOGGER.error(LogMarkers.VOICE_WEBSOCKET, "Encountered error while connecting voice websocket: ", e); } }
@Override public Future<Session> connect(Object websocket, URI uri) { client = new WebSocketClient(); client.getPolicy().setIdleTimeout(TIMEOUT); try { client.start(); } catch (Exception e) { e.printStackTrace(); } try { return client.connect(websocket, uri); } catch (IOException e) { throw new RuntimeException(e); } }
/** * Opens the initial websocket connection with the gateway. * If a connection was already open (in the case of reconnecting), it will be asynchronously closed. */ void connect() { WebSocketClient previous = wsClient; // for cleanup try { wsClient = new WebSocketClient(new SslContextFactory()); wsClient.getPolicy().setMaxBinaryMessageSize(Integer.MAX_VALUE); wsClient.getPolicy().setMaxTextMessageSize(Integer.MAX_VALUE); wsClient.start(); wsClient.connect(this, new URI(gateway), new ClientUpgradeRequest()); } catch (Exception e) { Discord4J.LOGGER.error(LogMarkers.WEBSOCKET, "Encountered error while connecting websocket: ", e); } finally { if (previous != null) { CompletableFuture.runAsync(() -> { try { previous.stop(); } catch (Exception e) { Discord4J.LOGGER.error(LogMarkers.WEBSOCKET, "Error while stopping previous websocket: ", e); } }); } } }
public WebSocketClientSelectorManager(WebSocketClient client) { super(client.getExecutor(),client.getScheduler()); this.bufferPool = client.getBufferPool(); this.policy = client.getPolicy(); }
public WebSocketClientSelectorManager(WebSocketClient client) { super(client.getExecutor(),client.getScheduler()); this.bufferPool = client.getBufferPool(); this.policy = client.getPolicy(); }
@Override public void init() { super.init(); _webSocketClient.setConnectTimeout(getConnectTimeout()); _webSocketClient.getPolicy().setIdleTimeout(getIdleTimeout()); int maxMessageSize = getOption(MAX_MESSAGE_SIZE_OPTION, _webSocketClient.getPolicy().getMaxTextMessageSize()); _webSocketClient.getPolicy().setMaxTextMessageSize(maxMessageSize); _webSocketClient.setCookieStore(getCookieStore()); _webSocketSupported = true; _webSocketConnected = false; }
public WebSocketClientConnection(EndPoint endp, Executor executor, ConnectPromise connectPromise) { super(endp,executor,connectPromise.getClient().getScheduler(),connectPromise.getClient().getPolicy(),connectPromise.getClient().getBufferPool()); this.connectPromise = connectPromise; this.masker = connectPromise.getMasker(); assert (this.masker != null); }
public WebSocketClientConnection(EndPoint endp, Executor executor, ConnectPromise connectPromise) { super(endp,executor,connectPromise.getClient().getScheduler(),connectPromise.getClient().getPolicy(),connectPromise.getClient().getBufferPool()); this.connectPromise = connectPromise; this.masker = connectPromise.getMasker(); assert (this.masker != null); }