Search in sources :

Example 11 with EzyConstant

use of com.tvd12.ezyfox.constant.EzyConstant in project ezyfox-server by youngmonkeys.

the class EzyCloseSessionImpl method doSendToClients.

protected void doSendToClients(EzySession session, EzyConstant reason) {
    EzyResponse response = newResponse(reason);
    context.sendNow(response, session);
}
Also used : EzyResponse(com.tvd12.ezyfoxserver.response.EzyResponse)

Example 12 with EzyConstant

use of com.tvd12.ezyfox.constant.EzyConstant in project ezyfox-server by youngmonkeys.

the class EzyAbstractResponseApi method secureResponse.

protected final void secureResponse(EzyPackage pack, boolean immediate) throws Exception {
    EzyConstant connectionType = getConnectionType();
    Collection<EzySession> recipients = pack.getRecipients(connectionType);
    if (recipients.isEmpty()) {
        return;
    }
    byte[] messageContent = dataToMessageContent(pack.getData());
    if (immediate) {
        for (EzySession session : recipients) {
            byte[] bytes = encryptMessageContent(messageContent, session.getSessionKey());
            session.sendNow(createPacket(bytes, pack));
        }
    } else {
        for (EzySession session : recipients) {
            byte[] bytes = encryptMessageContent(messageContent, session.getSessionKey());
            session.send(createPacket(bytes, pack));
        }
    }
}
Also used : EzyConstant(com.tvd12.ezyfox.constant.EzyConstant) EzySession(com.tvd12.ezyfoxserver.entity.EzySession)

Example 13 with EzyConstant

use of com.tvd12.ezyfox.constant.EzyConstant in project ezyfox-server by youngmonkeys.

the class EzyAbstractStreamingApi method response.

@Override
public void response(EzyBytesPackage pack) throws Exception {
    EzyConstant connectionType = getConnectionType();
    Collection<EzySession> recipients = pack.getRecipients(connectionType);
    if (recipients.isEmpty()) {
        return;
    }
    byte[] bytes = pack.getBytes();
    for (EzySession session : recipients) {
        session.send(createPacket(bytes, pack));
    }
}
Also used : EzyConstant(com.tvd12.ezyfox.constant.EzyConstant) EzySession(com.tvd12.ezyfoxserver.entity.EzySession)

Example 14 with EzyConstant

use of com.tvd12.ezyfox.constant.EzyConstant in project ezyfox-server by youngmonkeys.

the class EzySimpleAppUserDelegate method newExitedAppResponse.

protected EzyResponse newExitedAppResponse(EzyConstant reason) {
    EzyExitedAppParams params = new EzyExitedAppParams();
    EzyAppSetting appSetting = appContext.getApp().getSetting();
    params.setApp(appSetting);
    params.setReason(reason);
    return new EzyExitedAppResponse(params);
}
Also used : EzyExitedAppParams(com.tvd12.ezyfoxserver.response.EzyExitedAppParams) EzyAppSetting(com.tvd12.ezyfoxserver.setting.EzyAppSetting) EzyExitedAppResponse(com.tvd12.ezyfoxserver.response.EzyExitedAppResponse)

Example 15 with EzyConstant

use of com.tvd12.ezyfox.constant.EzyConstant in project ezyfox-server by youngmonkeys.

the class EzySimpleAppUserDelegate method responseUserRemoved.

protected void responseUserRemoved(EzyUser user, EzyConstant reason) {
    EzyResponse response = newExitedAppResponse(reason);
    EzyZoneContext zoneContext = appContext.getParent();
    zoneContext.send(response, user, false);
}
Also used : EzyZoneContext(com.tvd12.ezyfoxserver.context.EzyZoneContext) EzyResponse(com.tvd12.ezyfoxserver.response.EzyResponse)

Aggregations

EzyConstant (com.tvd12.ezyfox.constant.EzyConstant)6 EzySession (com.tvd12.ezyfoxserver.entity.EzySession)4 EzyZoneContext (com.tvd12.ezyfoxserver.context.EzyZoneContext)3 EzyPluginContext (com.tvd12.ezyfoxserver.context.EzyPluginContext)2 EzyUser (com.tvd12.ezyfoxserver.entity.EzyUser)2 EzyEvent (com.tvd12.ezyfoxserver.event.EzyEvent)2 EzyResponse (com.tvd12.ezyfoxserver.response.EzyResponse)2 EzyArray (com.tvd12.ezyfox.entity.EzyArray)1 EzyHashMapSet (com.tvd12.ezyfox.util.EzyHashMapSet)1 EzyController (com.tvd12.ezyfoxserver.controller.EzyController)1 EzyAbstractSession (com.tvd12.ezyfoxserver.entity.EzyAbstractSession)1 EzySimpleUserRemovedEvent (com.tvd12.ezyfoxserver.event.EzySimpleUserRemovedEvent)1 EzyUserRemovedEvent (com.tvd12.ezyfoxserver.event.EzyUserRemovedEvent)1 EzyRequestHandleException.requestHandleException (com.tvd12.ezyfoxserver.exception.EzyRequestHandleException.requestHandleException)1 EzyInterceptor (com.tvd12.ezyfoxserver.interceptor.EzyInterceptor)1 EzyRequest (com.tvd12.ezyfoxserver.request.EzyRequest)1 EzySimpleRequest (com.tvd12.ezyfoxserver.request.EzySimpleRequest)1 EzyDisconnectParams (com.tvd12.ezyfoxserver.response.EzyDisconnectParams)1 EzyDisconnectResponse (com.tvd12.ezyfoxserver.response.EzyDisconnectResponse)1 EzyExitedAppParams (com.tvd12.ezyfoxserver.response.EzyExitedAppParams)1