Code example for URI

0
 
	public WebSocket getInstance(String url, WebSocket.Draft draft) {
		WebSocket socket = null;
		Thread th = null;
		try { 
			socket = new WebSocket(appView, new URI(url), draft, getRandonUniqueId());
			th = socket.connect();
			return socket;
		} catch (Exception e) {
			//Log.v("websocket", e.toString()); 
			if(th != null) {
				th.interrupt();
			} 
		}  
		return null; 
	} 
 
	/** 
	 * Generates random unique ids for WebSocket instances 
	 *  
	 * @return String