/** * Is called after the low-level connection between the client and the server was established */ void sendHelloMessage() { // System.out.println("Session websocket connection established"); // Connection to the remote host was established // However the WAMP session is not established until the handshake was finished connectionController .sendMessage(new WampMessages.HelloMessage(stateController.clientConfig().realm(), stateController.clientConfig().helloDetails()), IWampConnectionPromise.Empty); }
/** * Is called after the low-level connection between the client and the server was established */ void sendHelloMessage() { // System.out.println("Session websocket connection established"); // Connection to the remote host was established // However the WAMP session is not established until the handshake was finished connectionController .sendMessage(new WampMessages.HelloMessage(stateController.clientConfig().realm(), stateController.clientConfig().helloDetails()), IWampConnectionPromise.Empty); }
/** * Is called after the low-level connection between the client and the server was established */ void sendHelloMessage() { // System.out.println("Session websocket connection established"); // Connection to the remote host was established // However the WAMP session is not established until the handshake was finished connectionController .sendMessage(new WampMessages.HelloMessage(stateController.clientConfig().realm(), stateController.clientConfig().helloDetails()), IWampConnectionPromise.Empty); }
public void performCall(final String procedure, final EnumSet<CallFlags> flags, final ArrayNode arguments, final ObjectNode argumentsKw, final AsyncSubject<Reply> resultSubject) { final long requestId = IdGenerator.newLinearId(lastRequestId, requestMap); lastRequestId = requestId; ObjectNode options = stateController.clientConfig().objectMapper().createObjectNode(); boolean discloseMe = flags != null && flags.contains(CallFlags.DiscloseMe) ? true : false; if (discloseMe) { options.put("disclose_me", discloseMe); } final CallMessage callMsg = new CallMessage(requestId, options, procedure, arguments, argumentsKw); requestMap.put(requestId, new RequestMapEntry(CallMessage.ID, resultSubject)); connectionController.sendMessage(callMsg, IWampConnectionPromise.Empty); }
void handleSessionError(ApplicationError error, String closeReason) { boolean reconnectAllowed = !stateController.clientConfig().closeClientOnErrors(); if (!reconnectAllowed) { // Record the error that happened during the session stateController.setCloseError(error); } closeIncompleteSession(error, closeReason, reconnectAllowed); }
void onSessionError(ApplicationError error, String closeReason) { boolean reconnectAllowed = !stateController.clientConfig().closeClientOnErrors(); if (!reconnectAllowed) { // Record the error that happened during the session stateController.setCloseError(error); } closeSession(error, closeReason, reconnectAllowed); }
void handleSessionError(ApplicationError error, String closeReason) { boolean reconnectAllowed = !stateController.clientConfig().closeClientOnErrors(); if (!reconnectAllowed) { // Record the error that happened during the session stateController.setCloseError(error); } closeIncompleteSession(error, closeReason, reconnectAllowed); }
void handleSessionError(ApplicationError error, String closeReason) { boolean reconnectAllowed = !stateController.clientConfig().closeClientOnErrors(); if (!reconnectAllowed) { // Record the error that happened during the session stateController.setCloseError(error); } closeIncompleteSession(error, closeReason, reconnectAllowed); }
void onSessionError(ApplicationError error, String closeReason) { boolean reconnectAllowed = !stateController.clientConfig().closeClientOnErrors(); if (!reconnectAllowed) { // Record the error that happened during the session stateController.setCloseError(error); } closeSession(error, closeReason, reconnectAllowed); }
void onSessionError(ApplicationError error, String closeReason) { boolean reconnectAllowed = !stateController.clientConfig().closeClientOnErrors(); if (!reconnectAllowed) { // Record the error that happened during the session stateController.setCloseError(error); } closeSession(error, closeReason, reconnectAllowed); }
/** * Send an error message in response to the request.<br> * This version of the function will use Jacksons object mapping * capabilities to transform the argument objects in a JSON argument * array which will be sent as the positional arguments of the call. * If keyword arguments are needed then this function can not be used.<br> * If this is called more than once then the following invocations will * have no effect. Respones will be only sent once. * @param errorUri The error message that should be sent. This must be a * valid WAMP Uri. * @param args The positional arguments to sent in the response */ public void replyError(String errorUri, Object... args) throws ApplicationError{ replyError(errorUri, ArgArrayBuilder.buildArgumentsArray(stateController.clientConfig().objectMapper(), args), null); }
/** * Send an error message in response to the request.<br> * This version of the function will use Jacksons object mapping * capabilities to transform the argument objects in a JSON argument * array which will be sent as the positional arguments of the call. * If keyword arguments are needed then this function can not be used.<br> * If this is called more than once then the following invocations will * have no effect. Respones will be only sent once. * @param errorUri The error message that should be sent. This must be a * valid WAMP Uri. * @param args The positional arguments to sent in the response */ public void replyError(String errorUri, Object... args) throws ApplicationError{ replyError(errorUri, ArgArrayBuilder.buildArgumentsArray(stateController.clientConfig().objectMapper(), args), null); }
/** * Send a normal response to the request.<br> * This version of the function will use Jacksons object mapping * capabilities to transform the argument objects in a JSON argument * array which will be sent as the positional arguments of the call. * If keyword arguments are needed then this function can not be used.<br> * If this is called more than once then the following invocations will * have no effect. Respones will be only sent once. * @param arguments The positional arguments to sent in the response * @param keywordArguments The keyword arguments to sent in the response */ public void reply(Object... args) { reply(ArgArrayBuilder.buildArgumentsArray( stateController.clientConfig().objectMapper(),args), null); }
/** * Send an error message in response to the request.<br> * This version of the function will use Jacksons object mapping * capabilities to transform the argument objects in a JSON argument * array which will be sent as the positional arguments of the call. * If keyword arguments are needed then this function can not be used.<br> * If this is called more than once then the following invocations will * have no effect. Respones will be only sent once. * @param errorUri The error message that should be sent. This must be a * valid WAMP Uri. * @param args The positional arguments to sent in the response */ public void replyError(String errorUri, Object... args) throws ApplicationError{ replyError(errorUri, ArgArrayBuilder.buildArgumentsArray(stateController.clientConfig().objectMapper(), args), null); }
/** * Send a normal response to the request.<br> * This version of the function will use Jacksons object mapping * capabilities to transform the argument objects in a JSON argument * array which will be sent as the positional arguments of the call. * If keyword arguments are needed then this function can not be used.<br> * If this is called more than once then the following invocations will * have no effect. Respones will be only sent once. * @param arguments The positional arguments to sent in the response * @param keywordArguments The keyword arguments to sent in the response */ public void reply(Object... args) { reply(ArgArrayBuilder.buildArgumentsArray( stateController.clientConfig().objectMapper(),args), null); }
/** * Send a normal response to the request.<br> * This version of the function will use Jacksons object mapping * capabilities to transform the argument objects in a JSON argument * array which will be sent as the positional arguments of the call. * If keyword arguments are needed then this function can not be used.<br> * If this is called more than once then the following invocations will * have no effect. Respones will be only sent once. * @param arguments The positional arguments to sent in the response * @param keywordArguments The keyword arguments to sent in the response */ public void reply(Object... args) { reply(ArgArrayBuilder.buildArgumentsArray( stateController.clientConfig().objectMapper(),args), null); }
@Override public void onEnter(ClientState lastState) { reconnectSubscription = stateController.rxScheduler().createWorker().schedule(new Action0() { @Override public void call() { if (stateController.currentState() != WaitingForReconnectState.this) return; // Reconnect now ConnectingState newState = new ConnectingState(stateController, nrReconnectAttempts); stateController.setState(newState); } }, stateController.clientConfig().reconnectInterval(), TimeUnit.MILLISECONDS); }
@Override public void onEnter(ClientState lastState) { reconnectSubscription = stateController.rxScheduler().createWorker().schedule(new Action0() { @Override public void call() { if (stateController.currentState() != WaitingForReconnectState.this) return; // Reconnect now ConnectingState newState = new ConnectingState(stateController, nrReconnectAttempts); stateController.setState(newState); } }, stateController.clientConfig().reconnectInterval(), TimeUnit.MILLISECONDS); }
@Override public void onEnter(ClientState lastState) { reconnectSubscription = stateController.rxScheduler().createWorker().schedule(new Action0() { @Override public void call() { if (stateController.currentState() != WaitingForReconnectState.this) return; // Reconnect now ConnectingState newState = new ConnectingState(stateController, nrReconnectAttempts); stateController.setState(newState); } }, stateController.clientConfig().reconnectInterval(), TimeUnit.MILLISECONDS); }
void closeSession(Throwable disconnectReason, String optCloseMessageReason, boolean reconnectAllowed) { // Send goodbye message with close reason to the remote if (optCloseMessageReason != null) { GoodbyeMessage msg = new GoodbyeMessage(null, optCloseMessageReason); connectionController.sendMessage(msg, IWampConnectionPromise.Empty); } stateController.setExternalState(new WampClient.DisconnectedState(disconnectReason)); int nrReconnectAttempts = reconnectAllowed ? stateController.clientConfig().totalNrReconnects() : 0; if (nrReconnectAttempts != 0) { stateController.setExternalState(new WampClient.ConnectingState()); } clearSessionData(); WaitingForDisconnectState newState = new WaitingForDisconnectState(stateController, nrReconnectAttempts); connectionController.close(true, newState.closePromise()); stateController.setState(newState); }