public void run () { if (lastPostURL == null) displayText("Click 'Post Test' to post some data first."); else net().req(lastPostURL).execute(displayer); } }, x, 10);
protected void loadURL (String url) { displayText("Loading: " + url); try { net().req(url).execute(displayer); } catch (Exception e) { displayText(e.toString()); } }
public void run () { if (_websock != null) displayText("Already connected."); _websock = net().createWebSocket("ws://echo.websocket.org", new Net.WebSocket.Listener() { public void onOpen() { displayText("WebSocket connected."); } public void onTextMessage(String msg) { displayText("Got WebSocket message: " + msg); } public void onDataMessage(ByteBuffer msg) { displayText("Got WebSocket data message: " + msg.limit()); } public void onClose() { displayText("WebSocket closed."); _websock = null; } public void onError(String reason) { displayText("Got WebSocket error: " + reason); _websock = null; } }); displayText("WebSocket connection started."); } }, x, 10);