private void doOnRefresh(CometClientTransportWrapper transport) { if (refreshState == null && transport == primaryTransport) { refreshState = RefreshState.CONNECTING; if (refreshTransport == null) { refreshTransport = new CometClientTransportWrapper(); } refreshTransport.connect(); listener.onRefresh(); } else if (transport == refreshTransport) { refreshEnqueue(REFRESH); } else { throw new IllegalStateException("Unexpected refresh from primaryTransport"); } }
private void doOnConnected(int heartbeat, int connectionID, CometClientTransportWrapper transport) { if (refreshState != null) { if (transport == refreshTransport) { if (refreshState == RefreshState.PRIMARY_DISCONNECTED) { doneRefresh(); } else if (refreshState == RefreshState.CONNECTING) { primaryTransport.disconnect(); doneRefresh(); } else { throw new IllegalStateException("Unexpected refresh state"); } } else { // refreshed connection after connection failed if (refreshState != RefreshState.CONNECTING && refreshState != RefreshState.PRIMARY_RECONNECT) { throw new IllegalStateException("Unexpected refresh state"); } refreshState = null; listener.onAfterRefresh(); } } else { listener.onConnected(heartbeat, connectionID); } }
private void doOnConnected(int heartbeat, int connectionID, CometClientTransportWrapper transport) { if (refreshState != null) { if (transport == refreshTransport) { if (refreshState == RefreshState.PRIMARY_DISCONNECTED) { doneRefresh(); } else if (refreshState == RefreshState.CONNECTING) { primaryTransport.disconnect(); doneRefresh(); } else { throw new IllegalStateException("Unexpected refresh state"); } } else { // refreshed connection after connection failed if (refreshState != RefreshState.CONNECTING && refreshState != RefreshState.PRIMARY_RECONNECT) { throw new IllegalStateException("Unexpected refresh state"); } refreshState = null; listener.onAfterRefresh(); } } else { listener.onConnected(heartbeat, connectionID); } }
private void doConnect() { primaryTransport.connect(); }
private void doConnect() { primaryTransport.connect(); }
private void doOnRefresh(CometClientTransportWrapper transport) { if (refreshState == null && transport == primaryTransport) { refreshState = RefreshState.CONNECTING; if (refreshTransport == null) { refreshTransport = new CometClientTransportWrapper(); } refreshTransport.connect(); listener.onRefresh(); } else if (transport == refreshTransport) { refreshEnqueue(REFRESH); } else { throw new IllegalStateException("Unexpected refresh from primaryTransport"); } }
/** * Send a message back to the server on this connection and use our broadcaster to send this message to * other clients connected to the same broadcaster. */ public void broadcast(List<?> messages) { primaryTransport.broadcast(messages); }
/** * Send a message back to the server on this connection and use our broadcaster to send this message to * other clients connected to the same broadcaster. */ public void broadcast(Object message) { primaryTransport.broadcast(message); }
/** * push message back to the server on this connection. On the serverside the message can be received * by the {@link AtmosphereGwtHandler#doPost} * */ public void post(Object message) { primaryTransport.post(message, postCallback); }
private void doOnError(Throwable exception, boolean connected, CometClientTransportWrapper transport) { if (connected) { transport.disconnect(); } listener.onError(exception, connected); }
public AtmosphereClient(String url, AtmosphereGWTSerializer serializer, AtmosphereListener listener, boolean webSocketsEnabled) { this.url = url; this.serializer = serializer; this.listener = listener; this.webSocketsEnabled = webSocketsEnabled; primaryTransport = new CometClientTransportWrapper(); }
/** * push message back to the server on this connection. On the serverside the message can be received * by the {@link AtmosphereGwtHandler#doPost} * */ public void post(Object message, AsyncCallback<Void> callback) { primaryTransport.post(message, callback); }
public AtmosphereClient(String url, AtmosphereGWTSerializer serializer, AtmosphereListener listener, boolean webSocketsEnabled) { this.url = url; this.serializer = serializer; this.listener = listener; this.webSocketsEnabled = webSocketsEnabled; primaryTransport = new CometClientTransportWrapper(); }
/** * push messages back to the server on this connection. On the serverside the message can be received * by the {@link AtmosphereGwtHandler#doPost} * */ public void post(List<?> messages, AsyncCallback<Void> callback) { primaryTransport.post(messages, callback); }
/** * push messages back to the server on this connection. On the serverside the message can be received * by the {@link AtmosphereGwtHandler#doPost} * */ public void post(List<?> messages) { primaryTransport.post(messages, postCallback); }
private void doDisconnect() { refreshState = null; primaryTransport.disconnect(); if (refreshTransport != null) { refreshTransport.disconnect(); } }
/** * Send a message back to the server on this connection and use our broadcaster to send this message to * other clients connected to the same broadcaster. */ public void broadcast(List<?> messages) { primaryTransport.broadcast(messages); }
private void doOnError(Throwable exception, boolean connected, CometClientTransportWrapper transport) { if (connected) { transport.disconnect(); } listener.onError(exception, connected); }
/** * push messages back to the server on this connection. On the serverside the message can be received * by the {@link AtmosphereGwtHandler#doPost} * */ public void post(List<?> messages, AsyncCallback<Void> callback) { primaryTransport.post(messages, callback); }
/** * push messages back to the server on this connection. On the serverside the message can be received * by the {@link AtmosphereGwtHandler#doPost} * */ public void post(List<?> messages) { primaryTransport.post(messages, postCallback); }