Code example for SocketChannel

Methods: close

0
	public void close() { 
		this.readyState = WebSocket.WEBSOCKET_STATE_CLOSING;
 
		// close socket channel 
		try { 
			this.socketChannel.close();
		} catch (IOException e) {
			this.onError(e);
		} 
		this.running = false;
		selector.wakeup();
 
		// fire onClose method 
		this.onClose();
 
		this.readyState = WebSocket.WEBSOCKET_STATE_CLOSED;
	} 
 
	/** 
	 * Sends <var>text</var> to server 
	 *