Java Code Examples for org.eclipse.jetty.websocket.WebSocket.Connection#close()
The following examples show how to use
org.eclipse.jetty.websocket.WebSocket.Connection#close() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DisconnectionTask.java From IoTgo_Android_App with MIT License | 6 votes |
@Override public void execute(JSONArray args, CallbackContext ctx) { try { int id = args.getInt(0); int code = args.getInt(1); String reason = args.getString(2); Connection conn = _map.get(id); if (conn != null) { if (code > 0) { conn.close(code, reason); } else { conn.close(); } } } catch (Exception e) { ctx.error("close"); } }
Example 2
Source File: DisconnectionTask.java From IoTgo_Android_App with MIT License | 6 votes |
@Override public void execute(JSONArray args, CallbackContext ctx) { try { int id = args.getInt(0); int code = args.getInt(1); String reason = args.getString(2); Connection conn = _map.get(id); if (conn != null) { if (code > 0) { conn.close(code, reason); } else { conn.close(); } } } catch (Exception e) { ctx.error("close"); } }
Example 3
Source File: DisconnectionTask.java From WebSocket-for-Android with Apache License 2.0 | 6 votes |
@Override public void execute(String rawArgs, CallbackContext ctx) { try { JSONArray args = new JSONArray(rawArgs); int id = Integer.parseInt(args.getString(0), 16); int code = args.getInt(1); String reason = args.getString(2); Connection conn = _map.get(id); if (conn != null) { if (code > 0) { conn.close(code, reason); } else { conn.close(); } } } catch (Exception e) { if (!ctx.isFinished()) { PluginResult result = new PluginResult(Status.ERROR); result.setKeepCallback(true); ctx.sendPluginResult(result); } } }
Example 4
Source File: GuacamoleWebSocketTunnelServlet.java From guacamole-client with Apache License 2.0 | 3 votes |
/** * Sends the given numeric Guacamole and WebSocket status * on the given WebSocket connection and closes the * connection. * * @param connection * The WebSocket connection to close. * * @param guacamoleStatusCode * The numeric Guacamole Status code to send. * * @param webSocketCode * The numeric WebSocket status code to send. */ private static void closeConnection(Connection connection, int guacamoleStatusCode, int webSocketCode) { connection.close(webSocketCode, Integer.toString(guacamoleStatusCode)); }
Example 5
Source File: GuacamoleWebSocketTunnelServlet.java From guacamole-client with Apache License 2.0 | 3 votes |
/** * Sends the given numeric Guacamole and WebSocket status * on the given WebSocket connection and closes the * connection. * * @param connection * The WebSocket connection to close. * * @param guacamoleStatusCode * The numeric Guacamole Status code to send. * * @param webSocketCode * The numeric WebSocket status code to send. */ private static void closeConnection(Connection connection, int guacamoleStatusCode, int webSocketCode) { connection.close(webSocketCode, Integer.toString(guacamoleStatusCode)); }